Page 60 - Dig_CodeAI_V2.1_Class_7
P. 60
Critical Thinking
code Quest
Look at these binary codes of numbers 1–10.
Number Binary Number Binary
1 0001 6 0110
2 0010 7 0111
3 0011 8 1000
4 0100 9 1001
5 0101 10 1010
Now answer the following in binary digits:
1. Write all the prime numbers between 1 and 10.
2. Write all the even numbers between 1 and 10.
3. Write the sum of 5 and 4.
4. Write all the numbers divisible by 3 between 1 and 10.
Conditions in a Program
While writing a program, we need to make certain decisions based on the logic of the program.
Such situations are called conditions. Conditional statements are used in a program to instruct the
computer to make a decision. The result of a condition will always be either True or False
IF-THEN-ELSE
Start
The program executes the statements
written inside the IF block when the
condition is True. If the condition is
False, the statements written inside IF (Condition)
the else block will be executed. A block True to be checked False
refers to a section of code that is Statements inside IF Statements inside ELSE
grouped together. block will execute block will execute
Stop
58 DigiCode AI (Ver. 2.1)-VII

