Wednesday, October 19, 2011

Program: To find greatest Of Three Using nested If-else Statement




CODE:

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,c;
cout<<"Enter three numbers (A,B,C): ";
cin>>a>>b>>c;
if(a>b)
{
if(a>c)
cout<<"A="<<a<<"is the Greatest";
else
cout<<"C="<<c<<"is the Greatest";
}
else
{
if(b>c)
cout<<"B="<<b<<"is the Greatest";
else
cout<<"C="<<c<<"is the Greatest";
}
getch();
}

Article by
Chief-Editor

He is a tech Enthusiast, an Altruist and calm mentor. He loves to code. He is also a creative graphic designer. Do check out his designfolio @ Jasmeet.asia If you like This post, you can follow me on Twitter.



For Further Reading,
C++ Program, Control Structures, If-Else Statement

0 comments:

Post a Comment