-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmarks.java
More file actions
68 lines (53 loc) · 1.3 KB
/
Copy pathmarks.java
File metadata and controls
68 lines (53 loc) · 1.3 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
67
68
import java.util.*;
public class marks {
public static void asc(int a[])
{
System.out.println();
System.out.print("marks in ascending array is ");
for(int i=0;i<a.length-1;i++)
{
for(int j=i+1;j<a.length;j++)
{
if(a[i]>a[j])
{
int temp;
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
for(int i=0;i<a.length;i++)
{
System.out.print(a[i]+ " , " );
}
System.out.println();
for(int i=0;i<a.length;i++) {
if(a[i]>=40 && a[i]<=50)
{
System.out.println("Marks for " +(i+1)+ " student are " +a[i]+" pass");
}
else if(a[i]>=51 && a[i]<=75)
{
System.out.println("Marks for " +(i+1)+ " student are " +a[i]+" merit ");
}
else if(a[i]>75)
{
System.out.println("Marks for " +(i+1)+ " student are " +a[i]+ " Distinction");
}
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input=new Scanner(System.in);
System.out.println("Enter the number of students");
int n=input.nextInt();
int []a=new int[n];
for(int i=0;i<n;i++)
{
System.out.println("Enter the marks of students " );
a[i]=input.nextInt();
}
asc(a);
}
}