Question #209391

1.     Write a program to read three integer numbers then find and print the largest one

among these numbers.


Expert's answer

#include<iostream>
using namespace std;
int main(){
	int first, second, third;
	cout<<"Enter the first the integer number"<<endl;
	cin>>first;
	cout<<"Enter the second the integer number"<<endl;
	cin>>second;
	cout<<"Enter the third the integer number"<<endl;
	cin>>third;
	int max;
	max = first;
	if(second>first && second > third ){
		max = second;
	}
	else if(third > first && third > second){
		max = third;
	}
  cout<<"The maximum integer number is:\t"<<max<<endl;
	
}
LATEST TUTORIALS
APPROVED BY CLIENTS