Sum of its Individual Digit Until Single Digits - WBUT MCA 2011
softetechnologies
18-11-2019    170 times
Sum Individual Digit Single WBUT MCA

Write a program to accept a number and find sum of its individual digits repeatedly till the result is a single digit. [WBUT MCA 2011]

#include <stdio.h>
int main()
{
    int no,i,sum;
    printf("Enter A Number : ");
    scanf("%d",&no);
    do{
        sum=0;
        while(no>0)
        {
            sum += no%10;
            no = no/10;
        }
        no=sum;
    }while(sum>9);
    printf("One Digit Sum is %d",sum);
}
Private Teacher
softetechnologies
softetechnologies
    Author Details
Arnab De
I have over 16 years of experience working as an IT professional, ranging from teaching at my own institute to being a computer faculty at different leading institute across Kolkata. I also work as a web developer and designer, having worked for renowned companies and brand. Through tutorialathome, I wish to share my years of knowledge with the readers.
    Related Post
  Query About the post