adding digits of a number in c

Solutions on MaxInterview for adding digits of a number in c by the best coders in the world

showing results for - "adding digits of a number in c"
Clara
14 Oct 2019
1//program to find the sum of digits:
2
3#include<stdio.h>
4int main()
5{
6  int num,sum=0,r,temp;
7  printf("Enter the number:\n ");  //taking input from the user
8  scanf("%d",&num);
9  
10  temp=num;           //assigning num to temporary variable
11  
12  while(temp!=0)
13  {
14    r=temp%10;
15    sum=sum+r;
16    temp=temp/10;
17  }
18  printf("\nGiven number = %d",num);
19  printf("\nSum of the digits = %d",sum);
20}
21
22//code By dungriyal
Ricardo
11 Oct 2020
1Enter the number
2300
3Given number = 300
4Sum of the digits 300 = 3
5 
6 
7Enter the number
816789
9Given number = 16789
10Sum of the digits 16789 = 31
queries leading to this page
write a program to calculate sum of digits of a number in cc program to calculate the number of permutations of given digitswrite a program to print sum of digit and reverse of a given numberfunction to count number of digits in cdigital sum program in cfind number of digits and their sum in cthe best way to add a number to a number in cprogram for finding the sum of given number with given no of digitssum of digits in integer c with 0c programming add 0 number digitsc add digit to integerprogram for sum of the digits of a given number cc program to count number of digits in an integerhow to add numbers in cc given length and sum of digitsc program for sum of digitsc program to find sum of even digits in a given numberwrite a program to find sum of 3 digit number entered by the user count sum of digits in cwrite a program to find the sum of all the digits of a number in csum of digits up to single digit in cprogram to find sum of digits3 write a c program to print sum of digits r algorithmprogram to calculate sum of digits1 to write a c program to print sum of digits of a given number program to add digits of a numberwrite a program to find the sum of all the digits of a number by taking n input in c14 09write a c program to calculate sum of digits of a numberc program to compute the sum of digits in a given integerwrite a program from one number from user and print sum of digitsum of digits in c using for loopsum of all the digits of a nuymber program in cc add digits instead of numbersc program to add 4 digit numberhow to take in an input of integers and sum all of the digits in chow to find the sum of the digits of a number in cc program to find total digits in a numberadd digit of a number in cfind out integer of sum of digit in cc program sum of digitsfinding sum of digits in csum of digits in integer cprogram to find sum of digits in chow to add numbers in c languagesum of digits in c user definedwap to print sum of digitsa c program to count number of digits in a numberhow to sum digits of a number in cc program if a sum is the sum of digits loopshow to print sum of no of digits in cc sum of digitssum of odd digits of a number in cc program to find sum of digits of a 5 digit numberhow to find sum of individual digits of a numberadd sum of digits in ccode to calculate sum of digits c4 program to find the sum of digits of a given number sum of all digits of an integer c6 write a c program to print sum of digits get the sum of a digits of a numbercode to calculate sum of digits in c using functionsdevelop a c routine to find sum of digits of given number 3fhow to add digit of a given numberformula to find number of digits in a number in cprinting sum of digits in csum digits of a number ccount the numer of digits in a int cdigit sum in c add numbers ccount number of digits in a number in cc program to find sum of digits of a 3 digit numberc sum of all digits in numberwrite a program to find the sum of digits of given number count the number of digits in cc programme to find the sum of digits of given numberhow to find sum of digits of a number in ccount the digits of a number in cadd the digits of a 2 digit number in chow to add digit of a numberaddition of digits of a given number in cprint sum of digits in cdigit sum csum of digit number in csum of different digits in cc given length and sum of digits find sum of digits of a number in cc program to calculate sum of digits of a number sum of 5 digits in cadding the digits of a number in cwrite a c program to find sum of individual digitsadd digits of intiget clet total number 3d 5 total number 3d number in cfind digits of a number and their sum in cc program to calculate sum of digits of a numberadding digits of a number in cprogram to sum of digits of a number in c in basesum of digits until single digit in chow to count the number of digits in an integer in c langnumber with digits sum as ccount the digit that reapeats more frequently in an integer in ccount digits in a number in csum of digits for the given number in c programc program to find the sum of digits of a numbersum of digits in c algorithmc program to count number of digits in given numberc program to find the sum of given numberc program to find sum of digits of a numberto add even digits from the given number c programadd digits together csum of digits c programc programme to find the sum of digitsdigits sum in csum of 4 digit number in csum of individual digits in chow to get the sum of digits in cadd digits of a number in ctotal of all digits and print them in cwrite a program to find out sum of digits of given number count no of digits in cfind digit sum of a number in cwriite a c program yo count total number of digits of an intiger numberhow to count number of digits in a number in cfind the sum of digitscheck if a number is sum of two digits in cadd all the digits together chow to sum all digits in a number in cc program find sum of digitsc program to find sum of digitssumming up the digits in chow to retrieve sum of digits 5cof number in cwrite a c program to count number of digits in any number c program to count total number of digits of an integersum of digits using function in csum of last x digits in ccode to calculate sum of digits c algorithmsum of digits in c languagesum of digits in csum of the digits of a number in cc program to find sum of digits of a 4 digit numberdifferent method to find sum of digitscalculate sum of all digits of number in cc program to add 4 digit number arrythe sum of digits of number in caddition two digit number in cwap to input a five digits number and find the sum of digitsadd a numbers in cwrite a c program to add digits of a numberhow to get the digits of an integer and sum the odd in cc program for adding digits of a numbersum of the even digits of a number program in cadd numbers in cwrite a c program to calculate sum of digits of a numberfind sum of all the digits in cc program to count number of digits in a numberprint the sum of digits of a given number in csum of digits that equal a number entered by the user in csum of digits of a number in cwrite a c program to calculate sum of inditiual digits of a positive numberhow to get the sum of digits of a number in csum of second digits of number in cif a three digit integer is input through the keyboard 2c write a program to calculate the sum of its digits write a program to take a number and calculate the sum of digit of a number in csum of all digits of a number in csum of digits of number in cprogram to sum of digits of a number in chow to count the digits in an int cc given length and sum of digits 2 write a c program to enter a 4 digit number and calculate sum of digitshow to count number of digits in cwrite a program to find the sum of all the digits of a number in ccount the number of digits in a number in c programcalculate sum of digits of a numberhow to find the sum of the digits in csum of the digit in csum of its digits in cc program to find the sum of digits for the given numberc program calculate sum of digits of numbersum of digit in c how to add numbers in an integer in cget digit sum program in cdigits sumin csum digits of a number in chow add the number of digits in cwrite a program to print the sum of all digits of a given numbersum of digits problem solution in csum of digits of 5 digit number in csyntax of rounding of floating point number in chow to add digits in a number in cadd 1 to individual digit of a number in csum of digits of a five digit number c programprint the sum of digits of a given numberwrite a program that takes an integer number and prints out the sum of the digitscount number of digits using loop in csum of numbers in a digit cc program to find sum of individual digits of a given numberhow to print directly sum of digits in csum of individual digits in c using functionfind the sum of digits in c programc program to calculate the sum of digits of a numbercount the number of digits in a number in csum of digits of the number in csum of digits in c programfunction in c to add digits of an integerwrite a program to sum the digits of any given integer number input 3a459sum 3a18program to calculate sum of digits of a number in cto find the sum of digits of a number in cwrite a program in c to calculate sum of all digits present in a user given number to count number of digits in a number in cadd the digits of a number in cc sum of all digits in a stringprogram to count number of digits in csum of digits cprogram to find sum of digits of a number in csum of digits of a number in c using for loopprint out the sum of two digits in csum of even digits in a number in cc program to sum of digitsadding digits of a number in c