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.
Printable View
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?
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