About us

C Program to find the sum of digits in the given number

C Program to find the sum of digits in the given number



c-program-find-sum-of-digits-number


#include<stdio.h>
#include<conio.h>
void main()
{
int d,sum=0;
clrscr();
printf("enter any number\n");
scanf("%d",&d);
while(d!=0)
{
sum=sum+d%10;
d=d/10;
}
printf("The sum of digits in the given number is %d",sum);
getch();
}

OUTPUT

enter any number
2101
The sum of digits in the given number is 4






C Program for swapping any two numbers
C Program for swapping any two numbers using two variables 
C Program for find factorial of the given number
C Program for finding the given number is prime or not
C Program for print prime numbers between 1 to 500
C Program for print table of the given number
C Program for the print table from 1 to 10
C Program for reverse the given number
C Program for finding the sum of digits in the given number
C Program for finding the product of digits in the given number
C Program for finding enter number is Armstrong or not
C Program for print Armstrong number between 1 to 500
C Program for find given number is Palindrome or not
More...,