









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










Introduction to computer science (^1)
Chapter 1 Algorithms Using Flowchart to describe Algorithm Algorithm in pseudo-code Branching in Algorithms Loop in Algorithms
Start Input Name, Hours, Rate Calculate Pay Hours Rate Dislay Name, Pay End Note: Name, Hours and Pay are variables in the program. Fig. 2.
Example 2.3: How to compute profit and loss. Fig. 4.
8
Display Name and Pay. Start Input Name, Hours, Rate Calculate Pay Hours Rate Dislay Name, Pay End
Example 2. Pseudo-code of the program: Input A if A > 0 then calculate B = sqrt(A) print B else Print “ A is negative” endif
Branching Example 4.2: Solving the quadratic equation: ax 2
Example 5.1 (^) Note: NUM NUM + 1 means old value of NUM + 1 becomes new value of NUM. Start NUM 4 SQNUM NUM 2 Print NUM, SQNUM NUM NUM + 1 NUM> 9? STOP No Yes The algorithm can be described in pseudocode as follows: NUM 4 do SQNUM NUM^2 Print NUM, SQNUM NUM NUM + 1 while (NUM <= 9)
Example 5. Programming Fundamentals 14 The algorithm sums all the even numbers between 1 and 20 inclusive and then displays then sum.
Exercise Give the flowchart of the program which finds the largest among three different numbers. Write the pseudo-code for the flowchart.
Ans. Input a,b,c if a > b then if a > c then print a endif else if b > c then print b else print c endif endif