Nothing Special   »   [go: up one dir, main page]

Algorithm - Docx Form 4-53AEB

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

Algorithm

Pseudocode

Characters, integers real string

ALGORITHM

1. Write and algorithm to find the sum of three numbers and print the results

Questions to ask yourself

(a) What the question is about? Start

(b) What are my input? Print ‘ Enter num1,num2,num3’

(c) What do they want me to do with my input? Read num1,num2,num3

(d) After I get my input what should I do with it? Find the sum

Display the results


PseudocoDE Print the results
Start Stop
Print ‘ Enter num1, num2, num3’
Flow chart
Read num1,num2,num3
start
Set sum num1 +num2+num3

Print ‘ Sum is’, sum

Stop
Print ‘ Enter
num,num2,num3’

Set sum num1 +num2+num3

Print ‘ Sum is’, sum

stop
2. Write an algorithm to find the square of a number?
Start

Pseudocode Print ‘ Enter num1’

Start Read num1

Print ‘ Enter num1’ Find the square

Read num1 Display the square

Set square num1 *num1 Print the square

Print ‘ Square is’, square Stop

Stop
3. Write and algorithm to enter the name and year of birth of a person and compute and display the age
of the person.

Start

Print ‘ Enter name’

Read name

Print ‘ Enter year of birth’

Read year of birth

Find the age

Display the age

Print the age

Stop

4. Write an algorithm to accept four numbers and produce and output of their sum, average and
product.

Start

Print ‘Enter num1,num2,num3,num4’

Read num1,num2,num3,num4

Find the sum

Find the average

Find the product

Display sum, average, product

Print sum, average, product

Stop

You might also like