If a five digit number is input through the keyboard, write a program to calculate the sum of its digit | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

If a five digit number is input through the keyboard, write a program to calculate the sum of its digit

Please do in c language

8th May 2020, 12:16 PM
Shubham Rawat
Shubham Rawat - avatar
5 Answers
+ 2
Use it and you will get the answer. Eg- 12345 12345%10 = 5 12345/10 = 1234 Now 1234%10 = 4 and 1234/10 = 123 : : Hope you get it.
8th May 2020, 12:52 PM
Avinesh
Avinesh - avatar
0
Yes please do it. Come back with your code if you have any doubt. Do not ask for complete code.
8th May 2020, 12:18 PM
Avinesh
Avinesh - avatar
0
Actually I don't understand, how to do it
8th May 2020, 12:23 PM
Shubham Rawat
Shubham Rawat - avatar
0
Do you know what does an % operator do?
8th May 2020, 12:24 PM
Avinesh
Avinesh - avatar
0
Yes
8th May 2020, 12:49 PM
Shubham Rawat
Shubham Rawat - avatar