Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(){
- int num1;
- int num2;
- int sum;
- cout << "Pick a number:\n";
- cin >> num1;
- cout << "Substract number " << num1 << " with:\n";
- cin >> num2;
- sum = num1 - num2;
- cout << num1 << " - " << num2 << " = " << sum << endl;
- if(sum > 50){
- cout << "Your number was larger than 50.\n";
- } else if(sum > 20){
- cout << "Your number was larger than 20.\n";
- } else if(sum < 20){
- cout << "Your number was below 20.\n";
- } else if(sum < 0){
- cout << "Cool! Your number was below 0.\n";
- // --- does not work, output will be: "Your number was below 20.".
- } else {
- cout << "Let me guess, your number was exactly 20? ;)\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement