Sunday, 11 December 2011

Write a program to print smallest in given 10 numbers in c

#include
#include
main()
{
int num,i,temp;
clrscr();
i=0;
printf("Enter A Number:");
scanf("%d",&num);
temp=num;
while(i<9) { printf("\nEnter A Number:"); scanf("%d",&num); if(temp>num)
{
temp=num;
}
i++;
}
printf("\n\nThe Smallest Number is:%d",temp);
getch();
}

OUTPUT

Enter a number : 5

Enter a number : 4

Enter a number : 56

Enter a number : 8

Enter a number : 6

Enter a number : 3

Enter a number : 8

Enter a number : 9

Enter a number : 10

Enter a number : 23

The Smallest Number is : 3

No comments:

Post a Comment