Skip to content

Instantly share code, notes, and snippets.

@JohnPhamous
Created October 17, 2017 17:45
Show Gist options
  • Save JohnPhamous/6c3d9d54242f68cf0c99cc39aa924840 to your computer and use it in GitHub Desktop.
Save JohnPhamous/6c3d9d54242f68cf0c99cc39aa924840 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main() {
cout << "Enter a number between -50 and 50: " << endl;
int userInt;
cin >> userInt;
if (userInt > 50 && userInt < -50) {
return 0;
}
if (userInt == 0) {
cout << "Your number is " << userInt << endl;
}
if (userInt % 10 == 0) {
if (userInt > 0) {
cout << "Your number is a positive multiple of 10" << endl;
}
else {
cout << "Your number is a negative multiple of 10" << endl;
}
}
if (userInt % 100 != 0) {
if (userInt > 0) {
cout << "Your number is positive and ";
}
else {
cout << "Your number is negative and ";
}
cout << "is between " << (userInt - userInt % 10) << " and " << (userInt - userInt % 10) + 10 << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment