Professional Documents
Culture Documents
CP1 - Selection Flowchart
CP1 - Selection Flowchart
START
A=0, B=0,
C=0
INPUT A, B, C
NO
OUTPUT C OUTPUT C
END
4. Write an interactive program that computes the area of rectangle ( area = base * height) and area of
triangle ( area = ½ * base * height). Let the user choose what area to compute by prompting the first
character of figure name ( R –Rectangle or T – Triangle) then compute and print the desired result.
START
FIG=0,
A_R=0, A_T=0,
B=0, H=0
INPUT FIG
YES
IF OUTPUT
YES B, H
INPUT A_R = B * H
FIG=R A_R
NO
IF YES OUTPUT
FIG=T INPUT B, H A_T = ½ * B * H A_T
NO
OUTPUT
INVALID
END