Question: Problem 1 : Let n = a k a k - 1 a k - 2 d o t s a 1 a 0 be

Problem1:
Let n=akak-1ak-2dotsa1a0 be an integer and t=a0-a1+a2-cdots+(-1)kak. It is known that n is evenly divisible by 11 if and only if t is evenly divisible by 11.
For example, suppose that n=8784204. Then, t=4-0+2-4+8-7+8=11. Because 11 is divisible by 11, it follows that 8784204 is divisible by 11.
If n=54063297, then t=7-9+2-3+6-0+4-5=2. Because 2 is not divisible by 11,54063297 is not divisible by 11.
Write a C++ program that prompts the user to enter a positive integer and then uses this criterion to determine whether the number is evenly divisible by 11.
1
Input /Output Samples:
Enter a positivo intoger -22
Invalid integer
.. Program finished with exit code 0
Press BNrER to exit console.
Linter a positive integer 54063297
54063297 is not divisable by 11
Press ENrBR to exit console.
Inter a positive integer 8784204
8784204 is divisable by 11
.. Program finished with exit code 0 Press BNHR to exit console.
 Problem1: Let n=akak-1ak-2dotsa1a0 be an integer and t=a0-a1+a2-cdots+(-1)kak. It is known

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!