-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLect4_Sol_Problem.java
More file actions
67 lines (61 loc) · 1.93 KB
/
Lect4_Sol_Problem.java
File metadata and controls
67 lines (61 loc) · 1.93 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
/*
Make a menu driven program. The user can enter 2 numbers, either 1 or 0.
If the user enters 1 then keep taking input from the user for a student’s marks(out of 100).
If they enter 0 then stop.
If he/ she scores :
Marks >=90 -> print “This is Good”
89 >= Marks >= 60 -> print “This is also Good”
59 >= Marks >= 0 -> print “This is Good as well”
Because marks don’t matter but our effort does.
(Hint : use do-while loop but think & understand why)
*/
import java.util.Scanner;
public class Lect4_Sol_Problem{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// System.out.println("Enter a Number if you inside then press 1 otherwise 0:");
// int inp = sc.nextInt();
// do{
// switch(inp){
// case 1:
// System.out.println("Enter your Marks Out of 100:");
// int marks = sc.nextInt();
// if(marks >= 90){
// System.out.println("This is Good!");
// break;
// }
// if(89 >= marks && marks >= 60){
// System.out.println("This is Also Good!");
// break;
// }
// if(59 >= marks && marks >= 23){
// System.out.println("This is Good as Well!");
// break;
// }
// if(22 >= marks && marks >= 0){
// System.out.println("This is Exellence!");
// break;
// }
// break;
// case 0: System.out.println("If you enter your input then press 1:");
// break;
// default: if(inp != 1 || inp != 0){
// System.out.println("Entered Value is Invalid! Try Again!");
// break;
// }
// }
// }while(false);
// It goes an Infinite State:
// for(; ;){
// System.out.println("Hello World");
// }
// Check Whether a Number is Prime or Not:
int no = sc.nextInt();
if(no/2 == 1 && no/no == 1){
System.out.println("It is a Prime Number");
}
else{
System.out.println("It is a Not Prime Number");
}
}
}