0
If a 5 digit number is entered by a user. Write a program to calculate sum of its digits
without using loops and remainder theorem
2 Antworten
+ 4
Hint:
* Use std::to_string() to convert number to string
* Ignore if string length not equal to 5
* Subtract each character by 48 to get the digit to add to sum variable.
+ 2
I think you should post it in coding challenges section