Write a program to find the smallest number out of the 3 numbers inputted by the user.

 

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,c;

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

if(a<b)
if(a<c)
cout<<"a is the smallest number";
else
cout<<"c is the smallest number";
else
if(b<c)
cout<<"b is the smallest number";
else
cout<<"c is the smallest number";

getch();
}

 

< Back