write a brief program on array finding sum of10 numbers
Answers
Answered by
1
import java.util.*;
class Array_Sum{
public static void main(String args[]){
Scanner in = new Scanner(System.in);
int arr[] = new int[10];
for(int i = 0; i < 10; i++);
System.out.println("Enter a number");
arr[i] = in.nextInt();
}
int sum = 0;
for(int j = 0; j < 10; j++){
sum = sum + arr[i];
}
System.out.println("The sum is: "+sum);
}
Hope this helps,
ira.
Similar questions
Social Sciences,
5 months ago
Math,
11 months ago
Math,
11 months ago
Math,
1 year ago
Physics,
1 year ago