Question
C++ Given a positive integer, it is possible to check whether the number is divisible by 11 (without residual) by the following test - subtracting
C++
Given a positive integer, it is possible to check whether the number is divisible by 11 (without residual) by the following test - subtracting and adding the digits of the number alternately, and if the result is divisible by 11, the original number is also divisible by 11. For example, we want to check if the number 2959 is divisible by 11 without residue. Subtracting and adding the digits 2 - 9 + 5 - 9- = 11. since the result 11 divides by 11, we know that 1995 is divisible by 11. Notice we must start with subtraction - No matter if you start from the left or right side of the number, the first action must be subtraction. Write a recursive function that receives an integer positive as a parameter and return "true" if the number is divisible by 11 and "false" if not.
Auxiliary functions may be defined and used provided they are also recursive.
DO NOT USE MODULUS OPERATOR.
For the kind helper - please try to write as simple as you can, and with as many explations as you can - im a begginer. thank you!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started