Question
What is the output of the following pseudo-code?
``` count = 0 for i from 1 to 3: for j from 1 to i: count = count + 1 print(count) ```Solution
Dry Run: `count = 0` `i = 1`: `j = 1`: `count = 0 + 1 = 1` `i = 2`: `j = 1`: `count = 1 + 1 = 2` `j = 2`: `count = 2 + 1 = 3` `i = 3`: `j = 1`: `count = 3 + 1 = 4` `j = 2`: `count = 4 + 1 = 5` `j = 3`: `count = 5 + 1 = 6` Final `count = 6`
The average of five consecutive even numbers is 56, and the average of four consecutive odd numbers is 'n'. The ratio of the high...
- The average height of a group of 30 players was recorded as 168 cm. Later it was discovered that 172 was wrongly written as 182 and 160 was written as 150....
Priya spends an average of Rs. 600 on Sundays and Rs. 450 on the remaining days. Find her average spending in a 30-day month starting with Sunday.
The batting average of 40 innings of a cricket player is 50 runs. His highest score exceeds his lowest by 172 runs. If the two are excluded, the average...
The average of 24 numbers is 48. If 5 is added to each number, then the new average will be:
What is the overall average of marks for all the students if three groups consist of 45, 35, and 40 students with average marks of 40, 60, and 45, respe...
A cricketer scored 240 runs in his first six matches of a tournament. Find the average runs the cricketer must score in the next four matches so that hi...
Average age of company A is 24 years and average age of both companies A and B is 12 years. If the ratio of number of employees in company A and B is 3:...
If a = 100, (a + b) = 400 and (c – b) = 80, find the average of the three numbers a, b and c.
The average weight of five students in a class is recorded as 58 kg. Two of the students have weights of 48 kg and 54 kg, but their actual weights are 4...