DESCRIPTION-:This program accepts three numbers as input and then calculate the largest number between the three number using the if statement and at last it display that largest number.
FOR EXAMPLE-: If we entered three number as-------
23 45 99
Then program generates output s---------
largest number is 99
PROGRAM-:
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int max,a,b,c;
cout<<"enter three numbers:";
cin>>a>>b>>c;
max=a;
if(b>max)
max=b;
if(c>max)
max=c;
cout<<"the largest of " <<a<<", "<<b<<" and "<<c<<" is " <<max;
getch();
}
FOR EXAMPLE-: If we entered three number as-------
23 45 99
Then program generates output s---------
largest number is 99
PROGRAM-:
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int max,a,b,c;
cout<<"enter three numbers:";
cin>>a>>b>>c;
max=a;
if(b>max)
max=b;
if(c>max)
max=c;
cout<<"the largest of " <<a<<", "<<b<<" and "<<c<<" is " <<max;
getch();
}
0 comments:
Post a Comment