0% found this document useful (0 votes)
4 views

Flowcharts and Pseudocode

Uploaded by

zanzoon20000
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Flowcharts and Pseudocode

Uploaded by

zanzoon20000
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Algorithm Design Practice

For each of the following questions, design an algorithm by writing the


pseudocode and drawing the flowchart

Question 1:
Write a program that asks the user to input two numbers, then add them and
display the sum.

Pseudocode
START Flowchart
num1 = "Enter the first number:"
num2 = "Enter the second number:"
sum = num1 + num2
Display sum
END

Page |1 Maysoon Alaaraj


Question 2:
Design an algorithm for a program that asks the user to input a number then
displays whether the number I odd or even.

Pseudocode END

START
num = "Enter a number:"
IF number MOD 2 == 0
THEN DISPLAY "The number is
even."
ELSE
DISPLAY "The number is odd." Flowchart

ENDIF

Question 3
Design an algorithm for a program
that prints numbers from 0 to N

Pseudocode
START

Page |2 Maysoon Alaaraj


N = "Enter the value of N:"
counter = 0
WHILE counter < N DO
DISPLAY counter
counter = counter + 1
ENDWHILE
END

Flowchart

Question 4
Design an algorithm for a program that asks user to input 3 numbers “a, b, c” and
displays which is the largest number (assume that none of the numbers are equal)

Page |3 Maysoon Alaaraj


Pseudocode Flowchart
START
a, b, c = “Enter numbers a, b, and c”
Check if a > b:
If true, check if a > c:
If true, display A as the largest number
-Else, display C as the largest number
If false, check if b > c:
If true, display B as the largest number
Else, display C as the largest number
END

Page |4 Maysoon Alaaraj

You might also like