answersLogoWhite

0

Program in c language to find the sum of digits?

Updated: 8/16/2019
User Avatar

Wiki User

12y ago

Best Answer

#include <stdio.h>

void main()

{

int digi,num,i,sum=0;

printf("Enter the number of digits:");

scanf("%d",&num);

while(i>0);

{

for(i=0;i<10000;i++)

{

digi=num;

i=digi%10;

sum=sum+i;

num=digi/10;

}

printf("The sum of digits entered is %d",sum);

}

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Program in c language to find the sum of digits?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you write an assembly language program to find the sum of n numbers using array?

write an assembly language program to find sum of N numbers


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); } }


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

Here You go........... # include&lt;stdio.h&gt; # include&lt;conio.h&gt; void main() { int no,sum=0,rem=0; clrscr(); printf("\nEnter a Number: "); scanf("%d",&amp;no); while(no&gt;0) { rem=no%10; sum=sum+rem; no=no/10; } printf("\nSum of digits of a number: %d",sum); getch(); }


What is the sum of the digits from 1 to 100?

5050, according to the program I quickly whipped up.


Find the sum of the digits in the smallest positive integers that is divisible by 2 and 4 and 6 and 10 and 12 and 14?

The sum of the digits is 6.


Algorithm for to find sum of individual digits of a positive integer?

enter the number whose digits are to be added num is the given value num=0! k=num%10 sum=sum=k k=num/10 num=k print the sum of the digits


Program in c language to find sum of digits using recursion?

# includevoid main(){int no,rem=0,sum=0,n; /*declaration*/printf("Enter 2 digit number:");scanf("%d",&no);for(n=1;n