-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathStudentmarks.java
50 lines (41 loc) · 1.17 KB
/
Studentmarks.java
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
import java.util.*;
public class Studentmarks {
void arrange(int arr[]){
for(int i=0;i<9;i++){
for(int j=i+1;j<10;j++){
if(arr[i]>arr[j]){
int temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;
}
}
}
merit(arr);
}
void merit(int arr[]){
for(int i=0;i<10;i++){
if (arr[i]>=40 && arr[i]<=50){
System.out.println("Pass" + arr[i]);
}
else if(arr[i]>50 && arr[i]<=75){
System.out.println("Merit" + arr[i]);
}
else if(arr[i]>75){
System.out.println("Distinction" + arr[i]);
}
else{
System.out.println("Fail" + arr[i]);
}
}
}
public static void main(String args[]){
int arr[]=new int[10];
System.out.println("Enter the marks of 10 students");
for (int i=0;i<10;i++){
Scanner sc=new Scanner(System.in);
arr[i]=sc.nextInt();
}
Studentmarks a1=new Studentmarks();
a1.arrange(arr);
}
}