Find the largest element in an array ?
#include<stdio.h>
#incliude<conio.h>
int main()
{
int a[50],size,i,j;
printf("\nEnter the size of the array: ");
scanf("%d",&size);
printf("\nEnter %d elements in to the array: ”, size);
for(i=0;i<size;i++)
scanf("%d",&a[i]);
j=a[0];
for(i=1;i<size;i++)
{
if(j<a[i])
j=a[i];
}
printf("\nBiggest: %d",j);
return 0;
}
No comments:
Post a Comment