-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDay29_prob2.java
More file actions
55 lines (40 loc) · 1.25 KB
/
Day29_prob2.java
File metadata and controls
55 lines (40 loc) · 1.25 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
/*
Puneet and Virat are playing a game. Virat tells a number that Puneet need to check whether that number is even and multiple of 3 or not. Write a program in which implement a method public boolean check(int n) which will return true if number satisfy the conditions else return false.
Input Format
One integer value representing number given by Virat.
Constraints
Number will lie between 20 and 400.
Output Format
True/False according to the value returned by the method or will print Invalid Input in case of number did not match the constraints.
Sample Input 0
60
Sample Output 0
True
Sample Input 1
12
Sample Output 1
Invalid Input
*/
// kirtan jain
import java.io.*;
import java.util.*;
public class Solution {
static String check(int n){
if(n%2==0 && n%3==0){
return "True";
}
else{
return "False";
}
}
public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
if(n<20 || n>400){
System.out.print("Invalid Input");
return;
}
System.out.print(check(n));
}
}