Computer Science, asked by svkavitha36, 6 months ago

Write an algorithm and draw a flowchart for the following:
1. To find the sum of five numbers and print its average.
2. Multiplication table for a given number.
3. Consider the following problem and draw only the flowchart for its solution. Hari bought a bag for Rs. 325 and sold the same for Rs. 425. Explain how we can find if Hari has made a profit or a loss.
4. Arrange the algorithm and draw a flowchart to play a snake & ladder game in the correct order.

Answers

Answered by aditi457211
1

Answer:

A flow chart is but a pictorial representation of an algorithm and is meant to depict the flow of control in a program.

The first step is to decide on an algorithm and maybe write it in the form of a pseudo code, an informal way of writing statements of a program without bothering about details of syntax.

Algorithms for the given problem:

[I]

Initialize Counter=0, Sum=0

Input integer

Add integer to Sum

Increment Counter

If Counter > 3, divide Sum by 3, Output result, stop

Else go to 2

[II]

Input Integer1, Integer2, Integer3

Average= ( Integer1+ Integer2+Integer3)/3

Output average

The second algorithm would be clumsy to find the average of a large number of inputs.

The first one can be easily generalised to handle n inputs, by introducing step 0 and modifying step 5

0. Input n

5. If Counter > n , divide Sum by n, Output result, stop

Note : There can be more ways of writing an algorithm for the problem by invoking loop control statements.

Having decided on the algorithm one can draw the flow chart following diagrammatic conventions, like using diamond boxes for decision (If), rectangles for assignment statements and conventional symbols [ ] for input and output. The control flow is to be indicated by directed arrows.

Similar questions