Program to sum of digits of a number in c**c program to sum the digit of number** program first find the digit of number from the reverse order and then sum up this constant into a variable. Let us see how the sum of digit of number is found:

248 = 2 + 4 + 8 = 14

## program to sum of digits of a number in c

#include <stdio.h> #include <conio.h> int main() { int number ,a , b=0; printf("enter the number to number up the digits\n"); scanf( "%d", &number ); while(number > 0 ) { a = number % 10; b = b + a ; number = number / 10 ; } printf("Sum of digits = %d", b ); getch(); }

### Output of program to sum of digits of a number in c:

c program to sum the digit of number |

You can also see other c programs with different categories like, basic programs, operating system, unit conversions, graphics programs, theory of computation, data structure, embedded system and many more.

Pingback: Program to sum of digits of a number in java - cprogramto.com

Pingback: c program for multiplying digits of number - cprogramto.com