Page 60 - Dig_CodeAI_V2.1_Class_8
P. 60
3. In a program, the statements following are executed when the condition specified
in the 'if' statement is false.
4. There are two types of loops counting loops and loops.
C. Answer the following questions:
1. How do loops help us?
2. Write an if condition to display “We have a match on Sunday” or “No, match on Sunday” based on
whether today is Sunday and if there is a cricket match.
3. Write an if condition to display “Exam today” or “No exam on weekend” if it is a weekday today or your
exam.
Critical Thinking
A. Write the output of the following programs:
1.
Repeat 5 times
{
READ Num1
READ Num2
Num1 4 7 87 45 22
IF Num1 > Num2 THEN
PRINT “Num1 is greater”
Num2 7 5 34 32 90
ELSE
PRINT “Num2 is greater”
Print
}
2.
Repeat 5 times
{
READ Marks
IF Marks > 50 THEN
PRINT "Pass"
ELSE
PRINT "Fail" Marks 45 40 55 49 85
}
Result
58 DigiCode AI (Ver. 2.1)-VIII

