Friday, April 10, 2015

22. Write a program to store 10 different constant variables in any array and print out the greatest number.

#include<stdio.h>
#include<conio.h>
#include<string.h> 
void main()
{
int i,large,num[10];
clrscr();
printf("\n Input any 10 number:- ");
for(i=0;i<10;i++)
{
printf("\n Number[%d]:- ",i+1);
scanf("%d",&num[i]);
}
large=num[0];
for(i=0;i<10;i++)
{
if(num[i]>large)
large=num[i];
}
printf("\n Largest number is %d",large);
getch();
}

No comments:

Post a Comment