Code Box
--------------------------------------
/*Program to find largest number in list
*/
#include<stdio.h>
#include<conio.h>
void main()
{
int num[10];
int i,k,large;
clrscr();
printf("\nEnter 10 number:");
for(i=0;i<10;i++)
{
scanf("%d",&num[i]);
}
printf("\nDone");
clrscr();
printf("\nYou entered:\n");
for(i=0;i<10;i++)
{
printf(" %d",num[i]);
}
printf("\n\nLargest numbers in list:\n");
large=num[0];
for(i=0;i<10;i++)
{
if(large<=num[i])
{
large=num[i];
}
}
printf(" %d",large);
getch();
}
No comments:
Post a Comment