Activities
Activity 1: build the flowchart to verify trigonometric identity + = 1
Follow these steps to build the flowchart
Step1 Create three variables called
‘S’, ‘C’, ‘S2’, ‘C2’, and ‘sum’.
[S= sin
C= cos
S2= Sin^2
C2= Cos^2
Sum= S2+C2]
Step2 use the ‘set command’ in the variable section of blockly. Set the ‘S’ to sin and ‘C’ to cos
Step3 Use the basic operation function from ‘math
Step4 Use ‘set command’ to put the values of S2 and C2 and set ‘sum’ = S2 + C2
Step5 Here the program will calculate the value Sum.
Srep6 Now use the if-else logic block to check if the value of ‘sum’ is equal to 1
Step7 If sum = 1, print “identity verified”, rint “ identity not verified
Now let us see the complete picture
The above process seems long and tiresome correct? Alternatively, the same program can be written as
But the flowchart will remain the same with a few modifications. So why go through a long process you may ask? Well, in the beginning, it is better to proceed step by step, as it helps not only understand the code better but also helps develop a program in a faster way as errors are minimized.
Congratulations! Now you are towards the end of this course. By now you have learned how to write codes. But as is said: ” A wise person learns from the mistakes of others.” In the next lesson, you will learn by correcting the erroneous code we provide. But till then, you can practice by making flowcharts for the completing following programs.
Code 1: Create a flowchart for code that prints your name 5 times.
Hint: you will need to use the loop do-while.
Code 2: Create a flowchart for code that prints the value of Sin for angles 0,30,60, and 90.
Hint: create a variable ‘A” and set it to 0. Use a loop for 4 repetitions and increase the value of A by 30 with each round.