Skip to content

Commit 66eddd5

Browse files
authored
Create Raju and his trip.c
1 parent 461320a commit 66eddd5

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/* Raju is planning to visit his favourite restaurant. He shall travel to it by bus. Only the buses whose numbers are divisible by 5 or by 6 shall take him to his destination. You are given a bus number N. Find if Raju can take the bus or not. Print YES if he can take the bus, otherwise print NO.
2+
3+
Input:
4+
The first and only line of the input shall contain an integer N, denoting the bus number.
5+
Output:
6+
Print YES if Raju can take that bus, else print NO.
7+
8+
Constraints
9+
1≤N≤106
10+
Sample Input 1:
11+
60
12+
Sample Output 1:
13+
YES
14+
Sample Input 2:
15+
16
16+
Sample Output 2:
17+
NO
18+
Sample Input 3:
19+
20
20+
Sample Output 3:
21+
YES
22+
EXPLANATION:
23+
In the first example, 60 is divisible by 5 and 6 both, so he can take the bus.
24+
In the second example, 16 is divisible by neither 5 nor 6, so he can't take the bus.
25+
In the third example, 20 is divisible by 5, so he can take the bus. */
26+
27+
#include <stdio.h>
28+
29+
int main(void) {
30+
31+
int t;
32+
scanf("%d",&t);
33+
//t is the bus number
34+
if((t%5==0)||(t%6==0))
35+
{
36+
printf("YES");
37+
}
38+
else
39+
{
40+
printf("NO");
41+
}
42+
return 0;
43+
}

0 commit comments

Comments
 (0)