Computer Science, asked by shreeya66, 10 months ago

write a brief program on array finding sum of10 numbers​

Answers

Answered by irakhedkar
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