Page 22 - Touchcode_C7_Flipbook
P. 22

Coding fact


                    Google was founded by Larry Page and Sergey Brin when they were
                    Ph.D. students at Stanford University in California.







                  In both daily tasks and coding, if we don’t put every step in the right sequence, the result

                  will be different from what we want.
                  So, the sequence is a list of activities which can be done one after another. It refers to the

                  specific order in which we need to perform the activities in order to get the desired output.

                    Coding           uiz   01                                                          Critical Thinking



                      State whether the following statements are true (T) or false (F).

                      a.  A sequence in programming is an ordered set of instructions.


                      b.  Loops make the code easier to understand.



                  EXAMPLES OF SEQUENCE, SELECTION AND ITERATION
                  To understand the concept of sequencing  in programming. Let’s take an example of

                  sequence, selection and iteration.
                                                                                                       Subject Enrichment
                     Example 1: Algorithm to swap two numbers. (Sequence)

                     Step 1: Start
                     Step 2: READ num1, num2

                     Step 3: temp=num1
                     Step 4: num1=num2

                     Step 5: num2=temp

                     Step 6: PRINT num1, num2
                     Step 7: Stop

                     To reach the final output, you need to follow the algorithm step by step.



                  Explanation: Read two numbers ‘num1’ and ‘num2’ that need to be swapped. Assign the
                  value of ‘num1’ to a temporary variable called ‘temp’ and the value of ‘num2’ to ‘num1’.



                   20     Touchcode-VII
   17   18   19   20   21   22   23   24   25   26   27