answersLogoWhite

0

#include<stdio.h>

#include<conio.h>

main()

{

int n,sum=0;

printf("enter n value");

scanf("%d",n);

while(n!=0)

{

n=n/10;

sum=sum+n;

n=n%10;

}

printf("sum is=%d",sum

}

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

How do you Write a java program to find the average of given numbers?

import java.util.Scanner; public class Numbers { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int max = -100; int min = 100; int sum = 0; System.out.println("Enter ten integers"); for(int i = 0; i &lt; 10; i++) { int input = scan.nextInt(); if(input &gt; max)//test if the number entered is larger than any previous number max = input; if(input &lt; min)//test if the number entered is smaller than any previous number min = input; sum += input;//add the input to the sum } System.out.println("The maximum number entered is: " + max + "\nThe minimum number entered is: " + min + "\nThe average of the numbers is: " + (sum / 10));//prints out the results } }


Write a programme in BASIC to find the sum of first fifty numbers entered through the keyboard?

10 for t = 1 to 50 20 input a 30 c = c + a 40 next t 50 print c


C code that will give the sum of all digits in a given input?

#include &lt;stdio.h&gt; main() { int nNum, nSum=0; printf("Enter value: "); scanf("%d", &amp;nNum); while(nNum!=0) { nSum = nSum + nNum; scanf("%d", &amp;nNum); } printf("Sum of all input %d", nSum); }


What is range on a spreadsheet?

An input range could be the range of cells a function needs to be entered to do its task. Many functions use input ranges. If you wanted a sum of a range of cells and specified them in a range, that would be an input range. In the following example the cells from A2 to A20 are the input range: =SUM(A2:A20)


Give a sample problem with the use of algorithm and flowchart symbols?

design a flowchart that will input three numbers and get their sum. If the sum is greater than 20, then print "sum&gt;20",else print the sum.


How do you get the catalog number for the blackheart in absurd math?

Input the sum of the key and the box, but it must be entered right after getting the key to work. At least that was the only way it work for me.


How does difference sum quotient and product alike?

They are all binary operators: two input values are combined to give an output.


C progrma to find recursive sum of digit of given no without using recursive function?

the function will be int sum_num(int num) { int p = 0, y; y = num; while (y != 0) { p = (y % 10) + p; y = y/10; } return p; } if you can help me with recursive function i would appreciate it Here it is - int SumOfDigits(int input) { int sum = 0; /// Compute the sum while(input &gt; 0) { sum += input %10; input /= 10; /// print value for examination printf(" %d %d\n",sum, input); } return sum; } int RecursiveSumOfDigits(int input) { /// Deal with the simplest case if(input &lt; 10) return input; printf("Recursing on %d\n",input); return RecursiveSumOfDigits(SumOfDigits(input)); }


Write a Java Program that reads a line of integers and then displays each integer and the sum of all the integers Use StringTokenizer class of javautil?

// Get input BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String input = in.readLine(); in.close(); // Parse input int sum = 0; StringTokenizer parser = new StringTokenizer(input); while (parser.hasMoreTokens()) { int currentInt = Integer.parseInt(parser.nextToken()); System.out.println(currentInt); sum += currentInt; } System.out.println("sum = " + sum);


What is the algorithm of the program to find sum and average of n different numbers?

1. start 2. sum=0 3. input n 3. for i=1 to n do 4. input x 5. sum=sum+x end of for (3) 6. avg=sum/n 7. output sum, avg 8. stop


Where can you enter a sum in excel?

A sum can be entered in any cell on a spreadsheet or by typing it into the formula bar. You can use calculations in lots of ways to do a sum, including the SUM function, the SUBTOTAL function, using Alt and the equals sign and using the Autosum button.A sum can be entered in any cell on a spreadsheet or by typing it into the formula bar. You can use calculations in lots of ways to do a sum, including the SUM function, the SUBTOTAL function, using Alt and the equals sign and using the Autosum button.A sum can be entered in any cell on a spreadsheet or by typing it into the formula bar. You can use calculations in lots of ways to do a sum, including the SUM function, the SUBTOTAL function, using Alt and the equals sign and using the Autosum button.A sum can be entered in any cell on a spreadsheet or by typing it into the formula bar. You can use calculations in lots of ways to do a sum, including the SUM function, the SUBTOTAL function, using Alt and the equals sign and using the Autosum button.A sum can be entered in any cell on a spreadsheet or by typing it into the formula bar. You can use calculations in lots of ways to do a sum, including the SUM function, the SUBTOTAL function, using Alt and the equals sign and using the Autosum button.A sum can be entered in any cell on a spreadsheet or by typing it into the formula bar. You can use calculations in lots of ways to do a sum, including the SUM function, the SUBTOTAL function, using Alt and the equals sign and using the Autosum button.A sum can be entered in any cell on a spreadsheet or by typing it into the formula bar. You can use calculations in lots of ways to do a sum, including the SUM function, the SUBTOTAL function, using Alt and the equals sign and using the Autosum button.A sum can be entered in any cell on a spreadsheet or by typing it into the formula bar. You can use calculations in lots of ways to do a sum, including the SUM function, the SUBTOTAL function, using Alt and the equals sign and using the Autosum button.A sum can be entered in any cell on a spreadsheet or by typing it into the formula bar. You can use calculations in lots of ways to do a sum, including the SUM function, the SUBTOTAL function, using Alt and the equals sign and using the Autosum button.A sum can be entered in any cell on a spreadsheet or by typing it into the formula bar. You can use calculations in lots of ways to do a sum, including the SUM function, the SUBTOTAL function, using Alt and the equals sign and using the Autosum button.A sum can be entered in any cell on a spreadsheet or by typing it into the formula bar. You can use calculations in lots of ways to do a sum, including the SUM function, the SUBTOTAL function, using Alt and the equals sign and using the Autosum button.


When completing a deposit slip Is all cash entered as one sum?

it is true,,