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

ALGORITHM, FLOWCHART AND SUB-ROUTINES

1. A program that accepts two numbers and checks whether they are equal or not.

Step1=start

Step2=input variable number

Start Step3=if number is equal print equal else

Not equal

Input numbers

No Are the yes

numbers

equal

print print

not equal ‘ equal’


end

2. A program that checks whether a number is an even or an odd number.

Step1=start
Step2=input variable even
Step3=if number mod2=0 is even print even else print odd
Step4=end

Start

Input number

Is mod2=0

No yes

Print odd
p print even
End

3. A program that checks whether a number is a positive or negative


number.

Step 1=start

Step 2=input variable age

Step 3=input age=18+ if positive print positive else print negative

Step 4=End

Start

Input number

No If user(s) yes

Age is 18+ print

Positive

Print negative PRINT POSITIVE


END

4. A program that accepts the height of a person in centimeters and


converts the value to meters.

Step1=start

Step2=input centimetres in person

Step3= input x

Step4= INPUT height=height in person*30.48

Height in metres =0.3048 meter

Print = x metres

Step 5=end

Start

input centimetres in person


input x

INPUT height=height in person*30.48

Height in metres =0.3048 meter.

Print = x metres

End
5. A program that accepts the Cost Price of an item and the Selling Price
of an item. The program then checks whether a profit or loss was made
after selling the item.

Start

Input cp,sp

no Amount=cp<sp yes

print print

loss profit

End

You might also like