Write a program that prompts the user to enter a positive integer and then uses this criterion to determine whether the number is divisible by 11.
Only positive integers are valid input. Negative integers as input should produce an error message. Use zero (0) as your sentinel value.
1
Expert's answer
2014-10-31T11:21:38-0400
using namespace std; int main() { int current_choice; while(true) { cout << "Enter and positive integer or zero to exit: "; cin >> current_choice; if (current_choice == 0) { cout << "End of program.\n"; break; } if (current_choice < 0) { cout << "Error! Please enter positive number or 0 to exit.\n"; } if (current_choice > 0) { if (current_choice % 11 == 0) cout << "Your number is divisible by 11!\n"; else cout << "Your number isn't divisible by 11!\n"; } }
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments