Ch4_CompareNumbers - if(num1> num2 larger = num1 cout<<"The larger number is"<< larger<< endl else if(num2> num1 larger =

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
//Program: Compare Numbers //This program compares two integers and finds the largest. / #include <iostream> # using namespace std; u int main() { int num1, num2, larger; cout << "Enter any two integers: "; cin >> num1 >> num2; cout << endl; cout << "The two integers entered are " << num1 << " and " << num2 << endl;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: if (num1 > num2) { larger = num1; cout << "The larger number is " << larger << endl; } else if (num2 > num1) { larger = num2; cout << "The larger number is " << larger << endl; } else cout << "Both numbers are equal." << endl; return 0; }...
View Full Document

This note was uploaded on 03/08/2011 for the course CSIT 139 taught by Professor Duzut during the Spring '11 term at Los Angeles City College.

Ask a homework question - tutors are online