forked from kunalbandale/Java-Programs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ExamAllowedOrNot.java
29 lines (24 loc) · 1.03 KB
/
ExamAllowedOrNot.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
import java.util.Scanner;
//A student will not be allowed to sit in exam if his/her attendence is less than 75%.
// Take following input from user
// Number of classes held
// Number of classes attended.
// And print
// percentage of class attended
//Is student is allowed to sit in exam or not.
public class ExamAllowedOrNot {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Number of classes attended");
int noOfClassesAttended = sc.nextInt();
System.out.println("Number of classes Held");
int noOfClassesHeld = sc.nextInt();
int yourAttedance = (noOfClassesAttended * 100 ) /noOfClassesHeld;
System.out.println("Your Attendance is :" + yourAttedance + "%");
if (yourAttedance <= 75) {
System.out.println("You are not eligible for writing exam");
} else {
System.out.println("You are eligible for writing exam");
}
}
}