Computer Science, asked by aghariyasamir, 2 months ago

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.​

Answers

Answered by kajalpal1975
7

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]);

}

}

Similar questions