Private: Code with Blockly
About Lesson

In this activity we will build a code that takes a number(N) as input and finds the sum(S) of all numbers from 1 to N.
But before beginning with the code, understand its flow. Let’s say the value of N=4

Now let’s build a code to implement the table above.
Step 1: Create 3 variables N, Sum, and count.
Step 2: Set the value of Sum =0 and count =1.
Step 3: use the following block so that the code asks for a value when run

Step 4: create a while loop with condition (count<=N).[ N is the number of terms to be added]
Step 5: set sum = sum + count[ remember, the code will read a mathematical equation from right to left. So for the code, the above equation becomes sum + count = sum. Same as shown in the table above)
Step 6: increase the value of count by 1. To do so, use the following block.

Fill in the form for S’O’A Fablab Orientation 2021.