how to write a programme that read an integer between 0 and 9999 and add all the digits in the integer. for example, if an integer is 8235, the sum of entire digit is 18.
how to write a programme that read an integer between 0 and 9999 and add all the digits in the integer. for example, if an integer is 8235, the sum of entire digit is 18.
i almost crazy ald~~~~~~~~~~~
i do hope somebody could help me
What have you tried?
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
for the adding of the numbers, I would say using a char array to hold each digit, and then adding them.
C Strings in C and C++ - Cprogramming.com