Opening Hours :7AM to 9PM
import java.util.Scanner; class Main { public static void main(String args[]) { int x,n,sum=0; Scanner s=new Scanner(System.in); System.out.println("Enter size of the array"); n=s.nextInt(); int marks[]= new int[n]; n=marks.length; for(x=0;x<n;x++) { System.out.println("Enter subject "+(x+1)+" marks"); marks[x]=s.nextInt(); while(marks[x]<0 || marks[x]>100) { System.out.println("Enter subject "+(x+1)+" marks again"); marks[x]=s.nextInt(); } sum=sum+marks[x]; } System.out.println(sum); } }