C Program to find sum of the Digits of a Number | Sum of Digits program in C

Spread the love

/*************Program************/

#include<stdio.h>
main()
{
int num,sum=0;
printf(“Enter any Number :”);
scanf(“%d”,&num);
while(num > 0)
{
sum = sum+num%10;
num = num/10;
}
printf(“Sum of Digits : %d..n”,sum);
}

/*************output************/

Venkatesh Macha

Hi Guys, I am Venkatesh Macha. I am a programmer and an Open Source enthusiast, Presently working as a Software Engineer. Apart from that, I love to explore new technologies and things.

You may also like...

Leave a Reply