#include<stdio.h>
#include<conio.h>
int main()
{
int n,*a,i,max;
printf("Enter the limit: ");
scanf("%d",&n);
a=(int*)malloc(n*sizeof(int));
for(i=0;i<5;i++)
{
printf("Enter the element %d:",(i+1));
scanf("%d",&a[i]);
}
max=a[0];
for(i=0;i<n;i++)
{
if(a[i]>max)
max=a[i];
}
printf("\nThe maximum number in the array %d\n",max);
getch();
return 0;
}
#include<conio.h>
int main()
{
int n,*a,i,max;
printf("Enter the limit: ");
scanf("%d",&n);
a=(int*)malloc(n*sizeof(int));
for(i=0;i<5;i++)
{
printf("Enter the element %d:",(i+1));
scanf("%d",&a[i]);
}
max=a[0];
for(i=0;i<n;i++)
{
if(a[i]>max)
max=a[i];
}
printf("\nThe maximum number in the array %d\n",max);
getch();
return 0;
}
No comments:
Post a Comment
Convey your thoughts to authors.