answersLogoWhite

0

C program to find the sum of the digits of a number?

Updated: 8/17/2019
User Avatar

Wiki User

13y ago

Best Answer

Here You go...........

# include<stdio.h>

# include<conio.h>

void main()

{

int no,sum=0,rem=0;

clrscr();

printf("\nEnter a Number: ");

scanf("%d",&no);

while(no>0)

{

rem=no%10;

sum=sum+rem;

no=no/10;

}

printf("\nSum of digits of a number: %d",sum);

getch();

}

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: C program to find the sum of the digits of a number?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write a Shell program to find the sum of cube of individual digits of a number?

no thanks


Shell program to find the sum of square of individual digits of a number?

There are many shell programs that will find the sum of the square of individual digits of a number. A small example is: SD=3n=2, sum=2, and SD=2.


How do you find the sum of digits of each number?

Add the digits together. The sum of the digits of 23 is 5.


Shell program to find the sum of cube of individual digits of a number?

Shell problems are programs that can be run to find out information about numbers. The problem can help find an even or odd number, or what the sum of a cube is.


What does find the sum of the digits of each number above mean?

Add the digits together. The sum of the digits of 23 is 5.


Write a java program to find out the sum of a number of n digits?

class Sum_Of_Digits { public static void printSumandnoofdigits(int n) { int temp = n; int count = 0; int sum = 0; while ( n &gt; 0 ) { sum = sum + n % 10; n = n / 10; count ++; } System.out.println("The number is..." + temp ); System.out.println("The sum of digits is..." + sum); System.out.println("The number of digits is..." + count); } }


Program in c language to find the sum of digits?

#include &lt;stdio.h&gt; void main() { int digi,num,i,sum=0; printf("Enter the number of digits:"); scanf("%d",&amp;num); while(i&gt;0); { for(i=0;i&lt;10000;i++) { digi=num; i=digi%10; sum=sum+i; num=digi/10; } printf("The sum of digits entered is %d",sum); } }


A two digit number is five times the sum of the digits if 9 is added to the number the digits are reversed find the number?

45


The sum of the digits of a two digit number is 16 if the digits were reversed and the new number were added to the original number the sum would be 176 find?

192


If the number of two digits are reversed it becomes 36 greater than the number find the number if the sum of the digits is equal to 8?

26


The sum of the digits of the number is 6?

the sum of my digits is 6? answer=60


When you reverse the digits in a certain two-digit number you increase its value by 9 Find the number if the sum of its digits is 7?

34.