maximum of three numbers

Write a program to find maximum of three numbers

Procedure:

  • Enter three numbers n1,n2,n3
  • If n1>n2 && n1 >n3, print n1
  • else if n2>n3, print n2
  • else print n3
#include<iostream>
using namespace std;
int main(){
	int a,b,c;
	cout<<"Enter three numbers "<<endl;
	cout<<"a : ";
	cin>>a;
	cout<<"b : ";
	cin>>b;
	cout<<"c : ";
	cin>>c;
	cout<<"The max of three numbers is : ";
	if(a>=b && a>=c) cout<<a;
	else if(b>=c) cout<<b;
	else cout<<c;
	return 0;
}
maximum of three numbers
maximum of three numbers

One Reply to “maximum of three numbers”

Leave a Reply

Your email address will not be published. Required fields are marked *