Find greatest from three values | If and if else


Write a program that input three numbers from user and display the greater number.


# include <iostream>
using namespace std;

void main() {

       int a;
       int b;
       int c;


       cout<<"Please enter the Value of A :";
       cin>>a;

       cout<<"Please enter the Value of B :";
       cin>>b;

       cout<<"Please enter the Value of C :";
       cin>>c;

//here the condition is used that whether the a is greater than b and must that b is less than c

       if(a>b && b<c)
             cout<<"The value of A is the greatest"<<endl;
       if(b>c)

//condition is tested that either b is greater than c or not

             cout<<"The value of B is the greatest"<<endl;
       else
              cout<<"The value of C is the greatest"<<endl;
}


Comments

Popular posts from this blog

Umbrella activities in Software Engineering

Operating System | Best Definition of Opetating System