Di Posting Oleh : Simple Learning
Kategori : c++ example greatest number between three c++
Program description
This program shows the greatest number between three numbers using if-else-if statement. It takes three numbers as input from user and output the greatest number.
code:
This program shows the greatest number between three numbers using if-else-if statement. It takes three numbers as input from user and output the greatest number.
code:
- #include<iostream>
- using namespace std;
- int main()
- {
- int num1,num2,num3;
- cout<<" Enter value for first number";
- cin>>num1;
- cout<<" Enter value for second number";
- cin>>num2;
- cout<<" Enter value for third number";
- cin>>num3;
- if(num1>num2&&num1>num3)
- {
- cout<<" First number is greatest:"<<endl<<"whick is= "<<num1;
- }
- else if(num2>num1&&num2>num3)
- {
- cout<<" Second number is greatest"<<endl<<"whick is= "<<num2;
- }
- else
- {
- cout<<" Third number is greatest"<<endl<<"whick is= "<<num3;
- }
- return 0;
- }
Note : If you have any query or idea about program
Comment below.
0 Response to "C++ program to find greatest number between three numbers"
Post a Comment