76 283
Assignments Done
Successfully Done
In May 2019

Answer to Question #48404 in C++ for alvin kassab

Question #48404
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.
Expert's answer
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";
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";
cout << "Your number isn't divisible by 11!\n";

return 0;

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!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions