Draw flowchart diagram for
the following programs, using
Loop.
1) A Program that display number
1 to 20
2) A program that display a person
name x times.
Answers
Answer:
Nirvik's answer is tongue-in-cheek, the reason is that calculating an average is so extremely easy that no-one would bother breaking it up in steps that are so tiny that it makes sense to draw up a flow chart for it. Part of the problem is that addition and division are built into the programming language you use and therefore those don't have to be spelled out in your algorithm.
The most explicit flowchart that takes + and / as atomic operations, describes how you'd implement the average of three numbers in machine language. It would look something like this (except draw it with nice boxes, of course):
START; input: three numbers in registers r1, r2 and r3.
Initialise r4 := r1
Add r2 to r4
Add r3 to r4
Divide r4 by 3.
STOP; output: the average is in r4.
It is still a boring flowchart because it has no loops or conditionals.