Praveen | Typing Speed Test is a very useful Software available for free Download.

C Programs to Add Digits

      C programs to Add digits are given below. In the first program add the digits given by the users.


Add digits to C programming code

#include<stdio.h>
#include<conio.h>



void main()
{
   int n, sum = 0, r;
   clrscr();
   printf("\n Enter the value ");
   scanf("%d",&n);
   while( n != 0 )
   {
      r = n % 10;
      sum = sum + r;
      n = n / 10;
   }
   printf("\n Sum of digits is -> %d",sum);
   getch();
}


Output:-