You are on page 1of 2

1. Draw a flowchart that will input 3 numbers and output the largest of the three numbers.

START

A=0, B=0,
C=0

INPUT A, B, C

YES NO YES YES


IF IF IF
OUTPUT B B>C A>C OUTPUT A
A>B

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

You might also like