answersLogoWhite

0


Best Answer

public class Add { public staticvoid main(String[] args) { int value=12; intcount=0; int sum=0; while(count<=4) { sum+=value%10; value=value/10; count++; } System.out.print("The sum of the individual integers is= "+ sum); } }

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

long n= 100, m= 500;

printf ("The sum is %ld\n", (m-n+1)*(m+n)/2);

This answer is:
User Avatar

User Avatar

Mabutho Bobo

Lvl 2
1y ago

123

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a program that reads an integer between 0 and 1000 and adds all the digits in the integer?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write a program to subtract integer y from integer x?

x -=y;


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

no thanks


How may ways are there to write 3 digit positive integer using 123456789 digits?

9*9*9 = 729 ways.


Using while loop write a program which calculates the product of digits from 1 to 5 and also show these nos vertically?

Using while loop, write a program which calculates the product of digits from 1 to 5 and also show these no's vertically.


How do you Write A program in c language for checking a diagonal matrix?

Write a program in c++ that take input in a integer matrix of size 4*4 and find out if the entered matrix is diagonal or not.


Write a program that input a positive integer and prints a triangle using for loop?

write a program that reads in the size of the side of square and then pints a hollow square of that size out of asterisks and blanks?


How do you Write a C program to reverse an Integer number.?

Reference:cprogramming-bd.com/c_page2.aspx# reverse number


How do you write a C Program to fill up an Integer Array?

Reference:cprogramming-bd.com/c_page1.aspx# array programming


How would i write a program that takes an integer as an input and reverses its digits as an output?

In java you can do it like this: import java.util.Scanner; public class Sample { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Input an integer: "); int i = input.nextInt(); System.out.print("reverse:"); while(i != 0) { System.out.print(i % 10); i = i / 10; } } }


How do you write a visual basic program to sum the odd number digits of a 12 digit code using division and Mod and while loops?

Function sum_odd_digits(ByVal number As Integer) As Integer Dim digit As Integer sum_odd_digits = 0 While number &lt;&gt; 0 digit = number Mod 10 If digit And 1 Then sum_odd_digits = sum_odd_digits + digit number = number / 10 End While End Function


Write a program to compute the sum of first ten integer numbers in PHP?

$n = 10*(1+10)/2;


How can I write a program to display prime numbers from 1 to 100?

Write a function that implements an algorithm that checks to see if a particular integer is prime (returning a boolean). Write a program that uses that function on each number from 1 to 100, and if true, displays that number.