Daily C++ Challenge – Day 895

Today is the 895th day of learning programming with the chilly rain!

Hello, everyone! This is the question from GESP202509 Level 2.

Day 895

Daily C++ Challenge - Day 895Daily C++ Challenge - Day 895

GESP202509 Level 2

Multiple Choice Question

Question 7

What is the output of the following C++ code after execution ( )?

Daily C++ Challenge - Day 895

A. 145

B. 125

C. 55

D. 45

Answer: D

START OF SPRING

Solution:This question tests the use of nested loops.

The outer loop executes 20 times, but the inner loop’s execution condition is j<i. The first value of i that meets the condition is 1, ending at 9. Therefore, there are a total of 45 opportunities for cnt+=1, which is the sum from 1 to 9.

Daily C++ Challenge - Day 895

20

25

11

Daily C++ Challenge - Day 895

NOVEMBER

Day

Monday

Tuesday

Wednesday

Thursday

Friday

Saturday

1

12

2

13

3

14

4

15

5

16

6

17

7

Beginning of Winter

8

Chinese Journalist Day

9

Fire Safety Day

10

21

11

22

12

23

13

24

14

25

15

26

16

27

17

28

18

29

19

30

20

October

21

Second Day

22

Light Snow

23

Fourth Day

24

Fifth Day

25

Sixth Day

26

Seventh Day

27

Thanksgiving

28

Ninth Day

29

Tenth Day

30

Eleven

Chilly Rain

Chilly Rain

Open Wisdom Station

Daily C++ Challenge - Day 895

Leave a Comment