Write a program in C++ to find the sum of digits and counting of digits. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Write a program in C++ to find the sum of digits and counting of digits.

The program must be in C++language

19th Aug 2018, 11:12 AM
Siddhi Agarwal
6 Answers
+ 11
as Nikhil said if you have any programming related query please first show your attempt else it looks like homework to all and you don't get the proper response so show your attempt first you will get positive responses
19th Aug 2018, 11:30 AM
GAWEN STEASY
GAWEN STEASY - avatar
+ 10
Please show us your attempt first.. It'll actually help you in learning better. If you've no idea how to start...then here's a hint for finding the sum of digits - * Find the remainder when divided by 10. add this to a variable * Divide the number by 10 and change the value of the number variable to the quotient. * Repeat the process until the number is larger than 0.
19th Aug 2018, 11:19 AM
Nikhil
Nikhil - avatar
+ 8
The process is similar for counting too.. Use a while loop until the number is larger than 0 ... Divide by 10... update the new value with the quotient.. and everytime increment the value of a variable ( for holding the total numbers ) by 1
19th Aug 2018, 11:23 AM
Nikhil
Nikhil - avatar
+ 1
what about counting?
19th Aug 2018, 11:20 AM
Siddhi Agarwal
+ 1
acha okay
19th Aug 2018, 11:23 AM
Siddhi Agarwal
0
pls give me the input it's urgent... hope u will help:)
19th Aug 2018, 11:21 AM
Siddhi Agarwal