C Program to find the smallest number among three numbers


In this program, You will learn how to find the smallest number among the three numbers in c.


10 20 30 => 10

40 50 30 => 30

Example: How to find the smallest number among three numbers in c.

#include<stdio.h>

int main() {

   int a, b, c;
   
   printf("Enter three numbers :");
   scanf("%d%d%d", &a, &b, &c);

   if (a < b && a < c) {
       printf("Smallest is :%d", a);
   } else if (b < c) {
       printf("Smallest is :%d", b);
   } else {
       printf("Smallest is :%d", c);
   }

   return 0;
}

Output:

Enter three numbers :10 20 30                                                                                                                                       
Smallest is :10