Statement of C Program: This Program prints the Largest element of an Array:
#include<stdio.h>
#include<conio.h>
#define MAX 6
void main()
{
float a[MAX] , large;
int i;
clrscr();
for(i=0 ; i<MAX ; i++)
{
scanf("%f" , &a[i]);
}
large = a[0]; /* Assume a[0] is the largest element */
for(i=1 ; i<MAX ; i++)
{
if (a[i] > large)
large = a[i];
}
printf(" Largest element = %f\n" , large);
} /* End of main() */
Output:
Enter 6 elements
88
29
54
68
95
12
Largest element = 95.000000
That's All
0 Response to "WAP of C Language to Find the Largest Element of an Array"
Post a Comment