7.2.3 Write algorithm for solving problems;
1. Algorithm to find the sum, product and average of five given numbers.
Step 1: Start
Step 2: Input 5
numbers (a, b, c, d, e)
Step 3: Add the 5
numbers (SUM=a+b+c+d+e)
Step 4: Divide SUM
by 5 (AVG=SUM/5)
Step 5: Output AVG (Average)
Step 6: Stop
2. Algorithm to find acceleration of a moving object with given mass and the force applied.
To find the acceleration of a
moving object with a given mass and the force applied, you can use Newton's
second law of motion, which states that the acceleration of an object is
directly proportional to the net force applied and inversely proportional to its
mass.
The formula to calculate
acceleration (a) is: a = F / m Where:
a = acceleration
F = net force applied
m = mass of the object
Step 2: Input Mass (m) and Force
applied (F)
Step 3: Calculate Acceleration (a)
[a=F/m]
Step 4: Output a (acceleration)
Step 5: Stop
3. Algorithm to find the volume of a cube, cylinder or sphere.
To
find the volume of a cube, cylinder, or sphere, you can use the following
formulas:
Volume
of a Cube: V = L^3
Volume
of a Cylinder: V = π * r^2 * h
Volume
of a Sphere: V = (4/3) * π * r^3
Step 1:
Start
Step 2:
Read the shape choice (Cube/Cylinder/Sphere)
Step 3:
If the shape choice is a Cube, go to Step 4; otherwise go to Step 6.
Step 4:
Ask the user to enter the length (L) of one side.
Step 5:
Calculate the volume of the Cube using the formula V = L^3.
Step 6:
If the shape choice is a Cylinder, go to Step 7; otherwise go to Step 9.
Step 7:
Ask the user to enter the radius (r) of the base and the height (h) of the
cylinder.
Step 8: Calculate
the volume of the Cylinder using the formula V = π * r^2 * h.
Step 9: For the volume
off Sphere: Ask the user to enter the radius (r) of the sphere.
Step 10: Calculate
the volume of the sphere using the formula V
= (4/3) * π * r^3.
Step 11: Display
the calculated volume (V) to the user.
Step 12:
Stop
4. Algorithm to find the area of a triangle, parallelogram, rhombus or trapezium.
To
find the area of a triangle, parallelogram, rhombus, or trapezium, you can use
the following formulas:
Area
of a Triangle: A = (b * h) / 2
Area
of a Parallelogram: A = b * h
Area
of a Rhombus: A = (d1 * d2) / 2
Area
of a Trapezium (Trapezoid): A = ((b1 + b2) * h) / 2
Step 2:
Read the shape choice (Triangle/Parallelogram/Rhombus/Trapezoid)
Step 3:
If the shape choice is a Triangle, go to Step 4; otherwise go to Step 6.
Step 4:
Ask the user to enter base (b) and the height (h).
Step 5:
Calculate the area of the Triangle using the formula A = (b * h) / 2.
Step 6:
If the shape choice is a Parallelogram, go to Step 7; otherwise go to Step 9.
Step 7:
Ask the user to enter the base (b) and the height (h).
Step 8: Calculate
the area of the Parallelogram using the formula A = b * h.
Step 9: If the shape
choice is Rhombus go to Step 10; otherwise go to Step 12.
Step 10:
Ask the user to enter the lengths of the diagonals. (d1 and d2)
Step 11: Calculate
the area of the Rhombus using the formula A
= (d1 * d2) / 2
Step 12: For
the area of Trapezoid: Ask the user to enter the lengths of the bases (b1 and
b2) and the height (h).
Step 13: Calculate
the area of the Trapezium using the formula A = ((b1 + b2) * h) / 2.
Step 14: Display the
calculated Area (A) to the user.
Step 15:
Stop
5. Algorithm to convert Celsius to Fahrenheit temperature and vice versa.
Celsius to
Fahrenheit:
The
temperature in Fahrenheit can be calculated by multiplying the temperature in
Celsius by 9/5 and adding 32.
Formula:
F = (C * 9/5) + 32
Step 1:
Start
Step 2:
Ask the user to enter temperature in Celsius (C).
Step 3:
Calculate the temperature in Fahrenheit using the formula:
F = (C * 9/5) +
32.
Step 4:
Output the value in Fahrenheit (F).
Step 5:
Stop
Fahrenheit to
Celsius:
The temperature in Celsius can be calculated
by subtracting 32 from the temperature in Fahrenheit and then multiplying the
result by 5/9.
Formula:
C = (F - 32) * 5/9
Step 1:
Start
Step 2:
Ask the user to enter temperature in Fahrenheit (F).
Step 3:
Calculate the temperature in Celsius using the formula:
C = (F - 32) *
5/9.
Step 4:
Output the value in Celsius (C).
Step 5:
Stop
6. Algorithm to
display the larger out of three given unequal numbers.
To display the larger one out of three given numbers we may use conditions in our algorithm.
Conditional Word/ Statement: IF
Step 1: Start
Step 2: Input the three unequal
numbers (a,b,c).
Step 3: If ‘a’ is greater than ‘b’
and ‘a’ is also greater than ‘c’ (a>b
&& a>c) then go to step 4; otherwise go to step 5.
Step 4: Output ‘a’.
Step5: If ‘b’ is greater than ‘a’
and ‘b’ is also greater than ‘c’ (b>a
&& b>c) then go to step 6 otherwise go to step 7.
Step 6: Output ‘b’.
Step 7: Output ‘c’.
Step 8: Stop.
7. Algorithm to assign grade to a subject based on the achieved marks.
Example
Grade Thresholds:
A:
90-100
B:
80-89
C:
70-79
D:
60-69
F:
below 60
Step
1: Start
Step
2: Ask the user to input their achieved marks (M).
Step
3: If marks are greater than or equal to 90 and less than or equal to hundred (90<=M<=100) then go to Step 4;
otherwise go to Step 5.
Step
4: Output ‘A’.
Step
5: If marks are greater than or equal to 80 and less than or equal to 89 (80<=M<=89) then go to Step 6;
otherwise go to Step 7.
Step
6: Output ‘B’.
Step
7: If marks are greater than or equal to 70 and less than or equal to 79 (70<=M<=79) then go to Step 8;
otherwise go to Step 9.
Step
8: Output ‘C’.
Step
9: If marks are greater than or equal to 60 and less than or equal to 69 (60<=M<=69) then go to Step 10;
otherwise go to Step 11.
Step
10: Output ‘D’
Step
11: If marks are less than 60 (M<60)
then go to Step 12.
Step
12: Output ‘F’.
Step
13: Stop.
8. Algorithm to find the interest on an amount.
To find the interest on an
amount, you need to know the principal amount (initial amount), the interest
rate, and the time period for which the interest is calculated.
The formula for calculating simple interest
is:
Interest = (P * R * T) / 100
Step 1:
Start
Step 2:
Input Principal amount (P), Interest rate (R) and Time period (T).
Step 3:
Calculate the interest rate using the formula: I=(P*R*T)/100.
Step 4: Output I (Interest).
Step 5:
Stop.
.png)
.png)
Comments
Post a Comment