0
695views
Write a program to find the largest of n numbers taken from user
1 Answer
0
21views
#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);
}
Please log in to add an answer.