Question

1. Write a program that asks the user to enter two integers, obtains the numbers from...

1. Write a program that asks the user to enter two integers, obtains the numbers from the user, then prints the larger number followed by the words “is larger.” If the numbers are equal, print the message “These numbers are equal.” Use only the single-selection form of the if statement you learned in this chapter.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
#include <iostream>

using namespace std;

int main(){
   int n1,n2;
   
   cout<<"Enter nunmber1: ";
   cin>>n1;

   cout<<"Enter nunmber2: ";
   cin>>n2;   
   
   if(n1 > n2){
      cout<<n1<<" is larger"<<endl;
   }
   else if(n1 < n2){
      cout<<n2<<" is larger"<<endl;
   }
   else{
      cout<<"These numbers are equal"<<endl;
   }
   
   return 0;
}

Add a comment
Know the answer?
Add Answer to:
1. Write a program that asks the user to enter two integers, obtains the numbers from...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT