Sum Limit is a logical problem based on the sum of two given digits. If the sum of the two digits has the same number of digits as the first given digit, return the sum of the two. If the sum has More digits than the first given digit return the first given digit only.
Given 2 non-negative ints, a and b, print their sum,
so long as the sum has the same number of digits as a.
If the sum has more digits than a, just return a without b.
Provided 2 solutions and used Solution 1 becasue it is more efficient. Tested both solutions and they work.
Example Test Out Put
• inputof(2,3) -> 5
• inputof(8,3) -> 8
• inputof(8,1) -> 9
Tested the code in the terminal using the commands
g++ main.cpp
./a.out
to test against the a.out
Screen Shot of the Test Output
file
About
Sum Limit is a logical problem based on the sum of two given digits. If the sum of the two digits has the same number of digits as the first given digit, return the sum of the two. If the sum has More digits than the first given digit return the first given digit only.