Declare and initialize value of array in int type. read and assgin all the mark to every students by using counter variable, k.
output should be like this; Students marks: student 1 : 10 student 2 : 15 student 3 : 89 student 4 : 56 student 5 : 76
import java.util.*;
class ArrayExample
{
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
System.out.println("Enter Marks of 5 students: ");
int marks[]=new int[5];
for(int k=0;k<marks.length;k++){
marks[k]=input.nextInt();
}
System.out.println("Student's Marks: ");
for(int k=0;k<marks.length;k++){
int i=k+1;
System.out.println("student "+i+": "+marks[k]);
}
}
}