answersLogoWhite

0

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

15y ago

What else can I help you with?

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


How do you write a program in qbasic to input 64751315 to sum?

In QBASIC, you can write a simple program to input the number 64751315 and sum its digits as follows: DIM sum AS INTEGER sum = 0 INPUT &quot;Enter a number: &quot;; number FOR i = 1 TO LEN(number) sum = sum + VAL(MID$(number, i, 1)) NEXT PRINT &quot;The sum of the digits is &quot;; sum This program prompts the user to input a number, iterates through each digit, converts it to an integer, and adds it to the total sum, which is then printed out.


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


Write a program to find Armstrong number in visual basic 10?

An Armstrong number (or narcissistic number) for a given number of digits is a number that is equal to the sum of its own digits raised to the power of the number of digits. Here’s a simple Visual Basic 10 program that checks for Armstrong numbers: Module ArmstrongNumber Sub Main() Dim num As Integer Dim sum As Integer = 0 Console.Write(&quot;Enter a number: &quot;) num = Convert.ToInt32(Console.ReadLine()) Dim temp As Integer = num Dim digits As Integer = num.ToString().Length While temp &gt; 0 Dim digit As Integer = temp Mod 10 sum += Math.Pow(digit, digits) temp \= 10 End While If sum = num Then Console.WriteLine(num &amp; &quot; is an Armstrong number.&quot;) Else Console.WriteLine(num &amp; &quot; is not an Armstrong number.&quot;) End If End Sub End Module This program takes a number as input, calculates the sum of its digits raised to the power of the number of digits, and checks if the sum equals the original number.


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