Program to calculate sum of digit of number

 CODE:-

#include <stdio.h>


int main()

{

    int total=0;

    int rem, d;

    printf("Enter the number= ");

    scanf("%d",&d);

    do

    {

        rem=d%10;

        d=d/10;

        total=total+rem;

    }

    while(rem>0);

    printf("Sum of digit number = %d",total);


    return 0;

}



Comments

Popular posts from this blog

Tips to improve Coding Skill