BIT102 ยท 2079 ยท 5 marks
What do you mean by flowchart? Draw a Flowchart to find the largest among three numbers entered by user.
What do you mean by flowchart? Draw a Flowchart to find the largest among three numbers entered by user. [5]
C ProgrammingChapter 4: Control StructuresFlowchart design
Quick answer
A flowchart is a diagrammatic or pictorial representation of an algorithm or a step-by-step solution to a given problem. It uses standard geometric symbols connected by arrows (flow lines) to show the sequence of steps, decisions, and operations required to solve a problem.
Flowchart
Definition
Common Flowchart Symbols
| Symbol | Shape | Purpose |
|---|---|---|
| Terminal | Oval / Rounded Rectangle | Start / Stop |
| Input/Output | Parallelogram | Read / Print data |
| Process | Rectangle | Arithmetic / Assignment operations |
| Decision | Diamond | Yes/No or True/False condition |
| Flow Lines | Arrows | Direction of flow |
Flowchart to Find the Largest Among Three Numbers
Problem: Read three numbers A, B, and C from the user and find the largest among them.
+----------+
| START |
+----------+
|
v
+------------------+
| Read A, B, C |
+------------------+
|
v
+------------+
| Is A > B? |
+------------+
/ \
YES NO
| |
v v
+--------+ +--------+
|Is A > C?| |Is B > C?|
+--------+ +--------+
/ \ / \
YES NO YES NO
| | | |
v v v v
+---+ +---+ +---+ +---+
| A | | C | | B | | C |
|is | |is | |is | |is |
|Lar| |Lar| |Lar| |Lar|
|gest |gest |gest |gest
+---+ +---+ +---+ +---+
\ \ / /
\ \ / /
\ \/ /
\ +----------+ /
\ | Print | /
+-->| Largest |<--+
+----------+
|
v
+--------+
| STOP |
+--------+
Clean Step-by-Step Logic
START
|
Read A, B, C
|
Is A > B?
โโโ YES --> Is A > C?
โ โโโ YES --> Print "A is Largest"
โ โโโ NO --> Print "C is Largest"
|
โโโ NO --> Is B > C?
โโโ YES --> Print "B is Largest"
โโโ NO --> Print "C is Largest"
|
STOP
Example Trace
| A | B | C | A > B? | Next Check | Result |
|---|---|---|---|---|---|
| 10 | 5 | 8 | YES | A > C? (10>8) YES | A = 10 is Largest |
| 3 | 9 | 6 | NO | B > C? (9>6) YES | B = 9 is Largest |
| 4 | 6 | 11 | NO | B > C? (6>11) NO | C = 11 is Largest |
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.