C program to find the sum of digits of a number

#include<stdio.h>
#include<conio.h>
void main()
{
int x,s=0;
puts("Enter the number");
scanf("%d",&x);
while(x!=0)
{
s=s+(x%10);
x=x/10;
}
printf("Sum = %d",s);
}

Comments