C Program to find smallest of three numbers using If Else statement
Program
#include<stdio.h>
void main()
{
int a, b, c;
printf("Enter three numbers:\n");
scanf("%d %d %d", &a, &b, &c);
if((a < b) && (a < c))
printf("a: %d is smallest\n", a);
else if(b < c)
printf("b: %d is smallest\n", b);
else
printf("c: %d is smallest\n", c);
}
Output 1
Enter three numbers:
12
54
34
a: 12 is smallest
Output 2
Enter three numbers:
64
10
42
b: 10 is smallest
Output 3
Enter three numbers:
87
62
31
c: 31 is smallest