Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

1.

Accept a number and display if it is even or odd


Algorithm
 INPUT: number
 PROCESES: modulus division
 OUTPUT: even/odd

Flowchart

Start

number

Yes No
If number
%2 ===0

Display Display
EVEN ODD

Stop

DCIT22 COMPUTER PROGRAMMING 1 1


2. Accept year level and display the following:
1 – Freshmen
2 – Sophomore
3 – Junior
4 – Senior
Algorithm
 INPUT: 1-4
 PROCESS: a=1, a=2, a=3 and a=4
 OUTPUT: when 1 is placed in output it will appear freshmen.

Flowchart

Start

a = input1-4

No
Yes
a=1 Freshmen

No
Yes
a=2 Sophomore

No
Stop
Yes

Junior
a=3

No
Yes
Senior
a=4

invalid

DCIT22 COMPUTER PROGRAMMING 1 2


3. Create a flowchart that will accept 2 numbers, num1 & num2. Using the choices below, the program will
perform the chosen
Operation and display the answer:
1 – Addition
2 – Subtraction
3 – Multiplication
4 – Division
Algorithm
 INPUT: num1 and num2
 PROCESS: addition, subtraction, multiplication, division
 OUTPUT: sum, difference, product, quotient

Flowchart

Start

num1, num2

sum = num1 = num2


diff = num1 – num2
prod = num1 * num2
quo = num1 / num2

Sum, diff, prod, quo

Stop

DCIT22 COMPUTER PROGRAMMING 1 3


Accept 3 numbers and display the highest and lowest
Algorithm
 INPUT: 3 numbers, num1, num2 and num3
 PROCESS: using this
 OUTPUT: largest number and smallest

DCIT22 COMPUTER PROGRAMMING 1 4

You might also like