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
-
Notifications
You must be signed in to change notification settings - Fork 0
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.
CoderCoding00/Sum_Limit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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.
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published