-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudent.java
More file actions
66 lines (59 loc) · 1.12 KB
/
Student.java
File metadata and controls
66 lines (59 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import java.util.*;
public class Student
{
public static void main(String[] args)
{
Scanner inp = new Scanner(System.in);
int[][][] a = new int[5][3][2];
System.out.println("Enter Marks");
for(int i=0;i<5;i++)
{
System.out.println("Enter Marks of Student"+(i+1));
for(int j=0;j<3;j++)
{
for(int k=0;k<2;k++)
a[i][j][k] = inp.nextInt();
}
}
int sum=0;
int[] total = new int[5];
for(int i=0;i<5;i++)
{
sum=0;
for(int j=0;j<3;j++)
{
for(int k=0;k<2;k++)
{
sum += a[i][j][k];
}
}
System.out.println("Score of Student "+(i+1)+" is: "+sum);
total[i] = sum;
}
int[] rank = new int[10];
/*
for(int i=0;i<5;i++)
{
rank[i*2+1] = i+1;
int max = total[i];
for(int j=i;j<5;j++)
{
if(max<total[j])
{
rank[i*2] = j;
int temp = max;
max = total[i];
total[i] = temp;
}
}
}
*/
Arrays.sort(total);
for(int i=0;i<5;i++)
{
System.out.println("\nDetails of Student"+(rank[i+1]));
System.out.println("Rank of Student: "+(i+1));
System.out.println("Total score of Student is: "+total[i]);
}
}
}