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); } }
long n= 100, m= 500;
printf ("The sum is %ld\n", (m-n+1)*(m+n)/2);
123
x -=y;
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 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 reads in the size of the side of square and then pints a hollow square of that size out of asterisks and blanks?
Reference:cprogramming-bd.com/c_page1.aspx# array programming
x -=y;
no thanks
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 no's vertically.
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 reads in the size of the side of square and then pints a hollow square of that size out of asterisks and blanks?
Reference:cprogramming-bd.com/c_page2.aspx# reverse number
Reference:cprogramming-bd.com/c_page1.aspx# array programming
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; } } }
Function sum_odd_digits(ByVal number As Integer) As Integer Dim digit As Integer sum_odd_digits = 0 While number <> 0 digit = number Mod 10 If digit And 1 Then sum_odd_digits = sum_odd_digits + digit number = number / 10 End While End Function
$n = 10*(1+10)/2;
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.