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