answersLogoWhite

0

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

16y ago

What else can I help you with?

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.


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 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.


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 do you write 31 as an integer?

31 is an integer.