Page 85 - ThinkGPT_V2.1_C6_Flipbook
P. 85
Advantages of Pseudocode
It is language-independent and can be used by most programmers to express the design in plain
and natural language.
Programmers do not have to think about syntax, they simply have to concentrate on logic.
The focus is on the steps to solving a problem rather than how to use the computer language.
Example 1: Write pseudocode to calculate profit and loss.
Solution:
Read CostPrice
Read SellingPrice
IF (SellingPrice >CostPrice ) THEN
Profit = SellingPrice - CostPrice
PRINT Profit
ELSE
Loss= CostPrice - SellingPrice
PRINT Loss
Example 2: Write pseudocode to print 'Above average marks' if the average marks in the three
subjects are greater than 60 and 'Below average marks' if the average marks are less than or equal
to 60.
Solution:
Read Eng_Marks
Read Math_Marks
Read Sci_Marks
Sum= Eng_Marks+Math_Marks+Sci_Marks
Avg_Marks = Sum / 3
IF (Avg_Marks > 60) THEN
PRINT "Above Average marks"
ELSE
PRINT "Below Average marks"
American computer scientist 'Margaret Hamilton,' wrote the
computer code which helped to save the Apollo moon landing
mission.
Using MakeCode Arcade 83

