Write a program to find the greatest 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 greatest number";
else
cout<<"c is the greatest number";
else
if(b>c)
cout<<"b is the greatest number";
else
cout<<"c is the greatest number";

getch();
}

< Back