import java.io.*;
public class sum{
public static void main(String[] args) {
try{
System.out.print("Enter 10 numbers: ");
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int[] input=new int[10];
int a,total=0;
for(a=0;a<10;a++) {
System.out.println();
input[a]=Integer.parseInt(br.readLine());
}
for(a=0;a<10;a++) {
total+=input[a];
}
System.out.println("The sum of the numbers is "+total);
}catch(Exception e) {
e.printStackTrace();
}
}
}
to print the sum of first ten numbers:- void main() {int i,sum; sum=0; while(i<=10) sum=sum+i; i=i+1; } printf("The sum is : %d",sum); }
Sum = Sum + first number Sum = Sum + second number Sum = Sum + third number Average = 1/3 x Sum
#include<iostream> unsigned sum_of_digits(unsigned num) { unsigned sum = 0; do { sum += num%10; } while (num/=10); return sum; } int main() { unsigned number = 12345; unsigned sum = sum_of_digits (number); std::cout << "Sum of digits in " << number << " is " << sum << std::endl; }
The sum of the two numbersis 105.7 the difference of the two number is19
To calculate the sum of all even numbers starting from 20 until the sum exceeds 1000, you can initialize a variable for the sum and a counter starting at 20. In a loop, add the counter to the sum and increment the counter by 2 (to keep it even) until the sum exceeds 1000. The final sum will be the total of all even numbers added. Here's a simple pseudocode example: sum = 0 number = 20 while sum <= 1000: sum += number number += 2
ten ones with an infinite number of zeroes.
118
129 - 112 = 17
Five
312
I am an even three digit number If you round me to the nearest ten I become 200 The sum of my digets is 18 What number am I?
9+90=99 (90 is ten times as much as 9)
48
the product of 8 and the sum of 10 and -7
The number of 0s in the product is equal to the sum of the number of 0s in the whole number that you started with and the power [of ten].
Sum = 0 For N = 1 to 10 Sum = Sum + 2*N Next N Print Sum
It means the sum of one hundred and ten and eight.