1.

Write a Java program to take the marks of students from roll numbers 0 to 4 and store them in an array. After storing the marks, print the marks of the student with roll number 4.​

Answer»

ANSWER:

IMPORT java.util.SCANNER;

public class Main {

public static void main(String[] args) {

int[] marks = NEW int[5];

Scanner sc = new Scanner(System.in);

for (int i = 0; i < 5; i++) {

System.out.println("ENTER marks of roll " + i);

marks[i] = sc.nextInt();

}

System.out.println("Marks of student will roll no. 4 = " + marks[4]);

}

}



Discussion

No Comment Found