Back To Java Arrays Index
//program to input an integer array of size 5 from the user and calculate total of the integer array using for loop public class totalintarray { public static void main(String[] args) { int []marks={88,89,90,78,77}; int i; int total=0; for(i=0;i<5;i++) { total=total+marks[i]; } System.out.println("total of marks in five subjects is " + total); } }