Sunday, 20 May 2012

Write a program to enter three numbers and find the smallest of them


/*program to find the smallest number within three numbers*/
void main()
{
int a,b,c;
clrscr();
printf("Enter three numbers ");
scanf("%d%d%d",&a,&b,&c);
if(a<b && a<c)
printf("%d is smallest",a);
else if(b<a && b<c)
printf("%d is smallest",b);
else
printf("%d is smallest",c);
}
Output
Enter three numbers 24 53 12
        12 is smallest

No comments:

Post a Comment