In this article, we will write a C++ program to find out the smaller number from given numbers. user will enter three numbers one by one and the program will print the value that is smaller among all three values.

C++ program to find out the smaller number from given numbers


C++ program to find out smaller number from given numbers.

#include<iostream>
#include<conio.h>

int main(void)
{

    int a,b,c,min;

    std::cout<<"Enter the value of a = ";
    std::cin>>a;
    std::cout<<"Enter the value of b = ";
    std::cin>>b;
    std::cout<<"Enter the value of c = ";
    std::cin>>c;

    if(a<b)
        if(a<c)
            min = a;
    if(b<a)
        if(b<c)
            min = b;
    if(c<a)
        if(c<b)
            min = c;

    std::cout<<"The Smaller number is = "<<min;

return 0;
}



Output

Enter the value of a = 5
Enter the value of b = 3
Enter the value of c = 1
The Smaller number is = 1