About Me

header ads

Program to find the largest element from the n numbers in array.


AIM: Write a Program to find the largest element from the n numbers in array.

#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int a[50],size,i,big;
printf("\nEnter the size of the array\n");
scanf("%d",&size);
printf("\nEnter elements in the array\n");
for(i=0;i<size;i++)
scanf("%d",&a[i]);
big=a[0];
for(i=1;i<size;i++)
{
if(big<a[i])
big=a[i];
}
printf("\nBiggest: %d",big);
    getch();
}

OUTPUT:
Enter the size of the array
4
Enter elements in the array  
23
27
78
96                                                                             
Biggest: 96