Question

Write the C++ if statement that compares the content of the quantity variable to the number...

Write the C++ if statement that compares the content of the quantity variable to the number 10. If the quantity variable contains a number that is greater than 10, display the string "Over 10"; otherwise display the string "Not over 10".

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<iostream>
using namespace std;
int main()
{
   int quantity;
  
   // Raeding the quantity
   cout<<"Enter Quantity"<<endl;
   cin>>quantity;
  
   //Checking if it greater than 10
   if(quantity>10)
   {
       cout<<"Over 10";
   }
   // If not greater than it will comes else block
   else
   {
       cout<<"Not over 10";
   }
   return 0;
}

Enter Quantity Over 1

Enter Quantity Not over 10

Add a comment
Know the answer?
Add Answer to:
Write the C++ if statement that compares the content of the quantity variable to the number...
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
ADVERTISEMENT