Question
how to write algorithm and pseudocode and how to draw flowchart to read an integer value from the key board and display a message indicating if the number is odd or result.
Answers
Algorithm:
Step 1: Start
Step 2: Declare integer variable num
Step 3: Read input from keyboard and store it in variable num
Step 4: Check if num modulo 2 equals to 0
Step 5: If it is true, display a message "The number is even"
Step 6: If it is false, display a message "The number is odd"
Step 7: Stop
Pseudocode:
BEGIN
DECLARE num as integer
READ num from keyboard
IF num modulo 2 is 0 THEN
DISPLAY "The number is even"
ELSE
DISPLAY "The number is odd"
ENDIF
END
Flowchart:
(https://i.imgur.com/zg2DlhL.png)
Step 1: Start
Step 2: Declare integer variable num
Step 3: Read input from keyboard and store it in variable num
Step 4: Check if num modulo 2 equals to 0
Step 5: If it is true, display a message "The number is even"
Step 6: If it is false, display a message "The number is odd"
Step 7: Stop
Pseudocode:
BEGIN
DECLARE num as integer
READ num from keyboard
IF num modulo 2 is 0 THEN
DISPLAY "The number is even"
ELSE
DISPLAY "The number is odd"
ENDIF
END
Flowchart:
(https://i.imgur.com/zg2DlhL.png)
Related Questions
how to write algorithm and pseudocode and how to draw flowchart to find the average,
max, min, a...
how to write algorithm and pseudocode and how to draw flowchart add the number from 1 to 100 and dis...
how to write algorithm and pseudocode and how to draw flowchart to read 10 integers from the keyboar...