Answers for "program that finds the sum of the digits of a number until single digit in c"

C
0

sum of individual digits in c using function

#include <stdio.h>

int individualSum(num);

void main ()
{
    int num, ret;

    ret = individualSum(num);
    printf("nThe sum of individual digit is %dn", ret);
}

int individualSum(num)
{
    int i, rem, sum = 0;
    printf("Enter the number: ");
    scanf("%d",&num);

    while(num!=0)
    {
        rem = num % 10;
        num = num /10;
        sum = sum + rem;
    }
  	
  return sum;
}
Posted by: Guest on June-23-2021

Code answers related to "program that finds the sum of the digits of a number until single digit in c"

Code answers related to "C"

Browse Popular Code Answers by Language