Algorithm solutions

7. Write an algorithm to enter the name and marks of Mathematics for 3 students and find

the average marks of the students and print the result.

Step1:start

Step2: Store the names of 3 students in a$,b$, and c$ respectively.

Step3: store the marks of 3 students in 3 subjects in x,y, and z respectively.

Step 4: Add x,y, and z and store the result in av.

Step5: Display av.

Step6: stop

8. Write an algorithm to find the perimeter of a rectangle.

Step1:start

Step2: Store the length and breadth of the rectangle in l and b respectively.

Step3: Add l and b and store the result in p.

Step 4: Multiply p with 2 and store the result in x.

Step5: Display x

Step6: stop

9. Write an algorithm to enter a number and print the square and cube of that number.

Step1: Start

Step2: Store a number in a.

Step 3: Multiply a with itself and store the result in b.

Step 4: Multiply a with itself twice and store the result in c.

Step5: Display b and c

Step6: stop

10. Write an algorithm to store two numbers. Find their sum, difference and product and print them.

Step1:start

Step2: Store two numbers in a and b respectively.

Step3: Add a and b and store the result in c.

Step 4: Subtract b from a and store the result in d.

Step5: Multiply a with b and store the result in e.

Step6: Display c,d, and e.

Step 7:stop

11. Write an algorithm to find the cost of 12 packets of soap, assuming each packet costs Rs. 57.

Step1:start

Step 2: declare variables a and b and initialize them with 12 and 57 respectively.

Step3: Multiply a with b and store the result in c

Step 4: Display c

Step5: End

Leave a Comment