Question 20 - Week 4 Practice | Prasnya
Prasnya
Continue with Google
Practice path
Dashboard
Exam
Qualifier / Quiz 1
Go to subject
Programing with python
Go to chapter
Week 4
Question 20
00:00
Est. 2 min
Marks:
+4.00
0.00
Select all the code snippets that print `Magic Number` if the number `n` leaves remainder
0
0
when divided by
7
7
but leaves remainder
1
1
when divided by
2
2
,
3
3
,
4
4
,
5
5
, and
6
6
. Otherwise, print `Not Magic Number`.
Single correct
Medium Difficulty
16 July 2023
A
``` n = int(input()) flag = 0 for i in range(2, 7): if n % i == 1: flag = 1 break if flag == 0 and n % 7 == 0: print("Magic Number") else: print("Not Magic Number") ```
B
``` n = int(input()) flag = 0 for i in range(2, 7): if n % i != 1: flag = 1 break if flag == 0 and n % 7 == 0: print("Magic Number") else: print("Not Magic Number") ```
C
``` n = int(input()) flag = 0 for i in range(2, 7): if n % i == 0: flag = 1 break if flag == 1 and n % 7 == 0: print("Magic Number") else: print("Not Magic Number") ```
D
``` n = int(input()) flag = 0 for i in range(2, 7): if n % (i + 1) == 1: flag = 1 break if flag == 0 and n % 7 == 0: print("Magic Number") else: print("Not Magic Number") ```