Page 93 - Computer Genius Class 07
P. 93

Step 4   Attach print block in do portion of if-do block. Add input block inside it.

                            y this step  i  the condition is satisfied  it  ill print   en  um er as Output.
                 Step 5   Attach print block in else portion of if-do block. Add input block inside it.

                            y this step  i  the condition is not satisfied  it  ill print Odd Number as Output.)

                 Step 6   Click on Run button. Enter the integer in the output window. Click on Enter button. Then
                          the output will be shown on the output window.





























                 Program to Find the Greatest Number

                 To create an A   onnect program to find the greatest num er out o  the three random num ers
                 create a project. In this project, create a Basic Coding activity. Then follow the given steps:

                 Step 1   Go to the Variables category and click on the Create variable... block to create a variables.
                          (Create three variables a, b and c)

                          Drag and drop set a to block from Variables category. Add int block from Conversion

                          category inside this block. Then, add input with prompt block from Input category inside
                          int block.

                          Follow the same steps for variable b and c.

                 Step 2   Attach if-do block from Logic category. Click on setting button of if-do block and add two
                          else if block and one else block in if-do block.

                 Step 3   In if portion of if-do block add comparisons for the variables using logical and relational
                           loc s.  ere  e ha e compared the first num er  a   ith the second     and third  c
                          number to check for the greatest. Add print block in do portion. Inside it add a block
                          and input block. It will print if the condition is true otherwise next condition will be
                          checked.




                                                                                  Exploring Math with Coding   91
   88   89   90   91   92   93   94   95   96   97   98