0

In C programming

Anyone know how to find the sum of individual digits of a positive integer ? Give me code couse I don,t know .

11th Feb 2023, 7:37 PM
Patel Resham Anil
Patel Resham Anil - avatar
1 Réponse
+ 3
If you don't know then learn it. Put your idea to solve it. Then try to code it in individual steps. First try yourself and post your attempt. So that it helps to identify your level in coding.. Like if input is 1234 then 1234%10 returns 4 so add this to a variable sum. Remove 4 from 1234 by 1234/10 = 123 Repeat above step until all 4+3+2+1 added. You can use a loop to achieve this. Print the result at end. Now, you can try and ask if any step is not able to code. But not total code... Hope it helps..
11th Feb 2023, 7:52 PM
Jayakrishna 🇮🇳