Design a pseudocode and a flowchart to input three numbers,find their total and average,and print both numbers.
sum=0
for i=1 to 3
read n
sum += n
avg = sum/3
print sum, avg
Sure! Here's a pseudocode and flowchart to solve the given problem:
Pseudocode:
1. Start
2. Declare variables num1, num2, num3, total, average
3. Read input for num1, num2, and num3
4. Calculate total = num1 + num2 + num3
5. Calculate average = total / 3
6. Print num1, num2, num3, total, and average
7. End
Flowchart:
+---------+
| Start |
+---+-----+
|
|
v
+-------------+
| Input num1 |
+---+---------+
|
|
v
+---- ----------+
| Input num2 |
+---- ----------+
|
|
v
+-------------+
| Input num3 |
+-------------+
|
|
v
+-----------------------+
| total = num1 + num2 + num3 |
+-----------------------+
|
|
v
+-------------------+
| average = total / 3 |
+-------------------+
|
|
v
+-----------------------+
| Print num1, num2, num3 |
| Print total |
| Print average |
+-----------------------+
|
|
v
+---------+
| End |
+---------+
I hope this helps!