66 994
Assignments Done
99,2%
Successfully Done
In November 2018

Answer to Question #48366 in C++ for ankita

Question #48366
take a number if it is more than 100 subtract 20 from it otherwise add 50 to it display the new nos
Expert's answer
// take a number if it is more than 100 subtract 20 from it otherwise add 50 to it display the new nos 
#include  <iostream> 
using namespace std;
  int main()
  {
int number;
int result=0;
cout << "please enter number" << endl;
cin>>number;
if(number>100)
{
cout << "number is > 100" << endl;
result=number-20;
}
else
{
cout << "number is < 100" << endl;
result=number+50;
}
    cout << "result = " << result<<endl;
    return 0;
  }
//  compiling on Linux:
//   g++ question.cxx -o question
//   ./question


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions