Find the Smallest of Three Numbers

Subject: PPS (Programming for Problem Solving)

Contributed By: Sanjay

Created At: February 3, 2025

Question:


Write a C Program to Find the Smallest of Three Numbers

Explanation Video:

Custom Image

Explanation:

 

Compare three numbers using if-else conditions.

Source Code:
#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("%d is the smallest.\n", a);
    else if (b <= a && b <= c)
        printf("%d is the smallest.\n", b);
    else
        printf("%d is the smallest.\n", c);

    return 0;
}
Input:
Enter three numbers: 
3
 7
 2
Output:
2 is the smallest.
Share this Article & Support Us: