Program to find Greatest number among three numbers.

Let’s write a program to print Largest number among three numbers in C++.

 

 

Step 1: Let’s open turboC++ and write the following Code:

 

 

//Code

 

#include<conio.h>

#include<iostream.h>

void main()

{

float a,b,c;

clrscr();

cout<<”enter first number:”; 

cin>>a;

cout<<”enter second number:”;

cin>>b;

cout<<”enter third number:”;

cin>>c;

if((a>b)&&(a>c))

{

cout<<” \n first number is greater”;

}

else if((b>a)&&(b>c))

{

cout<<”\n second number is greater”;

}

else if((c>a)&&(c>b))

{

cout<<”\n third number is greater”;

}

else

{

cout<<” \n you have entered equal numbers”;

}

getch();

}

 

 

 

Step 2: Run the program and see Output.

 

 

Output :

 

 

output

 

Happy Coding.

 

 

 

Tags: , , ,

Comments are closed.