Page 96 - Dig_CodeAI_V2.1_Class_8
P. 96
Critical Thinking
Write the output of the following programs:
1. x=1
sum=0
while(x<=10):
sum=sum+x
x=x+1
print (sum)
2. i = 2
while True:
if i%3 == 0:
break
print(i)
i += 2
3. i = 0
while i < 5:
print(i)
i += 1
if i == 3:
break
else:
print(0)
Experiential Learning
Competency-based/Application-based question Information Literacy
Swara wants to repeat a block of statements for a given number of times, until the
control condition is false. Which type of construct can she use for this?
Critical Thinking
code TASK Interdisciplinary Learning
Write a program to:
1. find the largest number out of three greatest number.
2. print the numbers 8, 11, 14, 17, 20, . . . .
3. print 1 to 100 using while loop.
4. find out the sum of numbers within the range 1 to 100 using while loop.
5. calculate the sum of first ten even numbers by using while loop and for loop.
6. print first 20 odd numbers in decreasing order using while loop.
Leadership & Responsibility
TECH VALUE Initiative
Never steal anyone's code.
94 DigiCode AI (Ver. 2.1)-VIII

