Coding | Mcqs | Multiple choice questions | Informative | Computer Science | Engineering | Aptitude | Quants | Verbal

INFEED

Test today 13

 1. code:


n=int(input())
if(n%2==0):
    print(n//2)
    print('2 '*(n//2))
else:
    print(((n-2)//2)+1)
    print('2 '*(((n-2)//2)) + "3")



2. Code :

 

n = int(input())
for i in range(n):
    ans = 0
    x = int(input())
    if x == 1:
        print(1)
        continue
    if x == 2:
        print(1)
        continue
    if x == 3:
        print(2)
        continue
    if x % 2: print((x - 1) // 2 + 1)
    else: print(x // 2)

Example:

1-b

2-b

3-b

4-c

5-b

6-b

7-c

8-a

9-b

10-a

11-d

12-d

13-c

14-c

15-b

16-d

17-a

18-b

19-c

20-b

Post a Comment

Previous Post Next Post