-----------------------------------------------------------------------------------------
/*Program to find smallest number in list
*/
#include<iostream.h>
#include<conio.h>
void main()
{
int num[10];
int i,small;
cout<<"\nEnter 10 number:";
for(i=0;i<10;i++)
{
cin>>num[i];
}
cout<<"\nDone";
clrscr();
cout<<"\nYou entered:\n";
for(i=0;i<10;i++)
{
cout<<" "<<num[i];
}
cout<<"\n\nSamllest numbers in list:\n";
small=num[0];
for(i=0;i<10;i++)
{
if(small>=num[i])
{
small=num[i];
}
}
cout<<" "<<small;
getch();
}
No comments:
Post a Comment