C lang Program to find largest of N numbers

C, C++, etc Programing examples. Post as many you can. Test the programs and discuss about the output of the programes.
Forum rules
Please Discuss & post only about the programes and its Output

C lang Program to find largest of N numbers

Postby karthick_l » Sat Dec 18, 2010 6:32 pm

/*C lang Program to find largest of N numbers */

#include<stdio.h>
#include<conio.h>
main()
{
int a[30],n,k,i;
clrscr();
printf("\\Program to find largest of N numbers\\ \n");
printf("Enter N value to get numbers:");
scanf("%d",&n);
printf("Enter the value to find the largest of N:%d numbers \n",n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
k=a[0];
for(i=0;i<n;i++)
if(a[i]>=k)
k=a[i];
printf("The largest of N:%d number is: %d",n,k);
getch();
}

Output

\Program to find largest of N numbers\
Enter N value to get numbers:20
Enter the value to find the largest of N:20 numbers
454
23
15
65
67
37
234
864
32
4
7
9
123
345
43
48
56
75
84
62
The largest of N:20 number is: 864
Regards
Karthick Loganathan
User avatar
karthick_l
Moderator
 
Posts: 7
Joined: Sat Dec 11, 2010 9:31 pm
membership: NA

ad
 

Return to Computer Notes : Some Sample Programs

Who is online

Users browsing this forum: No registered users and 0 guests