Here are my C++ program instructions 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. Example output (Program output should be in a similar format): 121 is divisible by 11 12 is not divisible by 11 Here's what I have so far: //input the neccessary #include-header files.#include <iostream> //input the neccessary namespace standards.using namespace std; //define the main functionint main(){//declare variablesint numb;int divi;int sum; //Prompt the user to input a number value to be tested.cout <<"Please enter a positive interger: ";cin >> numb;cout << endl; divi = numb;sum = 0; do{sum = sum + numb % 10;numb = numb / 10;sum = sum - numb % 10;numb = numb / 10;}while (numb > 0);cout <<"The sum of the intergers is: " << sum << endl;if (sum % 11 == 0){cout << divi <<" is divisible by 11" << endl;}else{cout << divi <<" is not divisible by 11" << endl;} return 0;} What I have to do is program a loop function to make the program work. However, I have no idea how to get that far. Everytime I look at it, I only see and infinite loop. Can someone help me?

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Here are my C++ program instructions

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.


Example output (Program output should be

in a similar format):


121 is divisible by 11

12 is not divisible by 11

Here's what I have so far:

//input the neccessary #include-header files.
#include <iostream>

//input the neccessary namespace standards.
using namespace std;

//define the main function
int main()
{
//declare variables
int numb;
int divi;
int sum;

//Prompt the user to input a number value to be tested.
cout <<"Please enter a positive interger: ";
cin >> numb;
cout << endl;

divi = numb;
sum = 0;

do
{
sum = sum + numb % 10;
numb = numb / 10;
sum = sum - numb % 10;
numb = numb / 10;
}
while (numb > 0);
cout <<"The sum of the intergers is: " << sum << endl;
if (sum % 11 == 0)
{
cout << divi <<" is divisible by 11" << endl;
}
else
{
cout << divi <<" is not divisible by 11" << endl;
}

return 0;
}

What I have to do is program a loop function to make the program work. However, I have no idea how to get that far. Everytime I look at it, I only see and infinite loop. Can someone help me?

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Concept of memory addresses in pointers
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education