C Program to Find the maximum element of array | C Program to find largest element from array | Program to Find highest value from given array in C language
#include < stdio.h >
#include < conio.h >
void main()
{
int a[100],max,i,n;
clrscr();
printf("Enter the size of an array\n");
scanf("%d",&n);
printf("Enter the elements %d for array\n", n);
for(i=0;i < n;i++)
{
scanf("%d",&a[i]);
}
max=a[0];
for(i=0;i < n;i++)
{
if(a[i]>max)
{
max=a[i];
}
}
printf("The max of the given array is %d",max);
getch();
}
No comments:
Post a Comment