0
I want to write a program that displays dijits of numbers and adds dijits
765 to display dijits and add them
1 Resposta
+ 8
● run a loop till n doesn't become 0
● use r=n%10 to get last digit of a number n as r. //print it.
● use sum = sum + r //for adding last digit everytime
● use n=n/10 for for removing units digit of number n.
//can do through recursion also, give it a try, if get struct U can insert the code & ask your doubt 👍