Example C program to find smallest of given 3 numbers:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
#include <stdio.h> int main() { float a, b, c; printf("\nPlease enter 3 numbers: "); scanf("%f %f %f", &a, &b, &c); if(a<=b && a<=c) printf("The smallest number is %.3f", a); if(b<=a && b<=c) printf("The smallest number is %.3f", b); if(c<=a && c<=b) printf("The smallest number is %.3f", c); return 0; } |