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
you can use the condition statement like for(i=0:i<=10;i++)
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
Write the following as an algebraic expression using x as the variable: The sum of a number and -8
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