Skip to content

Commit 72105d3

Browse files
authored
Create Is both or not.c
1 parent 939c954 commit 72105d3

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/* You're given a number N. If N is divisible by 5 or 11 but not both then print "ONE"(without quotes). If N is divisible by both 5 and 11 then print "BOTH"(without quotes). If N is not divisible by 5 or 11 then print "NONE"(without quotes).
2+
3+
Input:
4+
First-line will contain the number N.
5+
Output:
6+
Print the answer in a newline.
7+
8+
Constraints
9+
1≤N≤103
10+
Sample Input 1:
11+
50
12+
Sample Output 1:
13+
ONE
14+
Sample Input 2:
15+
110
16+
Sample Output 2:
17+
BOTH
18+
Sample Input 2:
19+
16
20+
Sample Output 2:
21+
NONE
22+
EXPLANATION:
23+
In the first example, 50 is divisible by 5, but not 11.
24+
In the second example, 110 is divisible by both 5 and 11.
25+
In the third example, 16 is not divisible by 5 or 11. */
26+
27+
#include <stdio.h>
28+
29+
int main(void) {
30+
31+
int n;
32+
scanf("%d",&n);
33+
if((n%5==0)&&(n%11==0))
34+
{
35+
printf("BOTH");
36+
}
37+
else if((n%5==0)||(n%11==0))
38+
{
39+
printf("ONE");
40+
}
41+
else
42+
{
43+
printf("NONE");
44+
}
45+
return 0;
46+
}

0 commit comments

Comments
 (0)