🧮 Algorithm Questions

Step-by-step algorithms with clear logic and structured solutions

← Back to Homepage
1. Write an algorithm to input two numbers and find their sum.
Algorithm:
Step 1: Start
Step 2: Input two numbers A and B
Step 3: Sum = A + B
Step 4: Display Sum
Step 5: Stop
2. Write an algorithm to input two numbers and calculate their difference.
Step 1: Start
Step 2: Input A and B
Step 3: Difference = A − B
Step 4: Display Difference
Step 5: Stop
3. Write an algorithm to find area of a rectangle.
Step 1: Start
Step 2: Input length and breadth
Step 3: Area = length * breadth
Step 4: Display Area
Step 5: Stop
4. Write an algorithm to calculate perimeter of a rectangle.
Step 1: Start
Step 2: Input length and breadth
Step 3: Perimeter = 2 * (length + breadth)
Step 4: Display Perimeter
Step 5: Stop
5. Write an algorithm to calculate area of a circle.
Step 1: Start
Step 2: Input radius r
Step 3: Area = 3.14 * r * r
Step 4: Display Area
Step 5: Stop
6. Write an algorithm to calculate circumference of a circle.
Step 1: Start
Step 2: Input radius r
Step 3: Circumference = 2 * 3.14 * r
Step 4: Display Circumference
Step 5: Stop
7. Write an algorithm to find product of two numbers.
Step 1: Start
Step 2: Input A and B
Step 3: Product = A * B
Step 4: Display Product
Step 5: Stop
8. Write an algorithm to check even or odd.
Step 1: Start
Step 2: Input number N
Step 3: If N mod 2 = 0, display Even
Step 4: Else display Odd
Step 5: Stop
9. Write an algorithm to calculate total marks of five subjects.
Step 1: Start
Step 2: Input marks of 5 subjects
Step 3: Total = sum of all marks
Step 4: Display Total
Step 5: Stop
10. Write an algorithm to calculate average of three numbers.
Step 1: Start
Step 2: Input A, B, C
Step 3: Average = (A + B + C) / 3
Step 4: Display Average
Step 5: Stop
11. Write an algorithm to print numbers from 1 to 10.
Step 1: Start
Step 2: Set i = 1
Step 3: While i ≤ 10
Step 4: Display i
Step 5: i = i + 1
Step 6: Stop
12. Write an algorithm to print even numbers from 2 to 20.
Step 1: Start
Step 2: Set i = 2
Step 3: While i ≤ 20
Step 4: Display i
Step 5: i = i + 2
Step 6: Stop
13. Write an algorithm to print the square of a given number.
Step 1: Start
Step 2: Input number N
Step 3: Square = N * N
Step 4: Display Square
Step 5: Stop
14. Write an algorithm to find the largest of two numbers.
Step 1: Start
Step 2: Input two numbers A and B
Step 3: If A > B then display A as the largest number
Step 4: Else display B as the largest number
Step 5: Stop
15. Write an algorithm to calculate Simple Interest.
Step 1: Start
Step 2: Input Principal (P), Time (T), and Rate (R)
Step 3: SI = (P * T * R) / 100
Step 4: Display Simple Interest (SI)
Step 5: Stop