-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnot.java
More file actions
49 lines (46 loc) · 1.29 KB
/
not.java
File metadata and controls
49 lines (46 loc) · 1.29 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
import java.util.Scanner;
public class not {
public static void main(String[] args) {
int mat,phys,music,chem,tur;
Scanner sc = new Scanner(System.in);
int count=0;
double total=0;
System.out.println("enter math grade:");
mat = sc.nextInt();
if(mat >= 0 && mat <= 100){
count++;
total += mat;
}
System.out.println("enter physics grade:");
phys = sc.nextInt();
if(phys >= 0 && phys <= 100){
count++;
total += phys;
}
System.out.println("enter music grade:");
music = sc.nextInt();
if(music >= 0 && music <= 100){
count++;
total += music;
}
System.out.println("enter chemistry grade:");
chem = sc.nextInt();
if(chem >= 0 && chem <= 100){
count++;
total += chem;
}
System.out.println("enter Turkish grade:");
tur = sc.nextInt();
if(tur >= 0 && tur <= 100){
count++;
total += tur;
}
double average = total/count;
if(average >55){
System.out.println("you pass the course!");
}else{
System.out.println("you failed !");
}
sc.close();
}
}