0% found this document useful (0 votes)
40 views6 pages

ALGORITHM

The document contains 5 examples of algorithms and flowcharts for simple programs that check conditions and perform basic calculations. The examples include programs that check if numbers are equal, if a number is even or odd, if a number is positive or negative, converts centimeters to meters, and checks for profit or loss.

Uploaded by

animemaster2k
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)
40 views6 pages

ALGORITHM

The document contains 5 examples of algorithms and flowcharts for simple programs that check conditions and perform basic calculations. The examples include programs that check if numbers are equal, if a number is even or odd, if a number is positive or negative, converts centimeters to meters, and checks for profit or loss.

Uploaded by

animemaster2k
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/ 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