0
2.3kviews
Write a program to find the largest of n numbers taken from user
1 Answer
written 6.0 years ago by |
#include<stdio.h>
#include<conio.h>
void main( )
{
int n,i,a[100],large;
clrscr();
printf("Enter the number of elements:");
scanf("%d",&n);
for(i=0;i<=n-1;i++)
{
printf("Enter a value:");
scanf("%d",&a[i]);
}
large=a[0];
for(i=1;i<=n-1;i++)
{
if(large<a[i])
large=a[i];
}
printf("The largest number is %d",large);
}