C Program Of Sum of digit

C Program Of Sum of digit

#include<stdio.h>

main()
{

int n,no,sum=0;

printf("Enter no:\n");
scanf("%d",&n);

while(n>0)
{

no=n%10;
sum=sum+no;
n=n/10;
}

printf("%d\n",sum);

}

Related Posts