0% found this document useful (0 votes)
15 views

Algorithm

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Algorithm

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

2.

write algorithm to find out the average of five numbers


Answer:
1. START
2. Write down the five numbers: 10, 20, 30, 40, and 50.
3. Add all five numbers together to get 150.
4. Count the total number of numbers, which is 5.
5. Divide the total sum, 150, by the count, 5, to get 30.
6. Write down the result as the average: 30.
7. STOP

3. write an algorithm to calculate the area of a rectangle whose length and


breadth are given (l,b)
Answer:
1. START
2. Take the length l and breadth b of the rectangle.
3. Multiply length l by breadth b.
4. Write down the result as the area of the rectangle.
5. STOP

4. write an algorithm to find perimeter of a rectangle


Answer:

1. START
2. Take the length l and breadth b of the rectangle.
3. Add length l and breadth b together.
4. Multiply the result by 2.
5. Write down the result as the perimeter of the rectangle.
6. STOP

5. write an algorithm to find greatest number among three numbers


Answer:

1. START
2. Input a number and stores in a variable X.
3. Input a number and stores in a variable Y.
4. Input a number and stores in a variable Z.
5. Assume X is greatest and stores it in a variable G.
6. If Y is greater than G, update value G by Y.
7. If Z is greater than G, update value G by Z.
8. Greatest number is G.
9. STOP
6. write an algorithm to input a number to find out whether it's even or odd

Answer:

1. START
2. Input a number and store it in variable N.
3. Divide N by 2 and find the remainder.
4. If the remainder is 0, then N is an even number.
5. If the remainder is not 0, then N is an odd number.
6. Output the result indicating whether the number is even or odd.
7. STOP

7. write an algorithm to input the age of 2 persons and find out who is elder

Answer:

1. START
2. Input the age of the first person and store it in variable A.
3. Input the age of the second person and store it in variable B.
4. Compare the ages A and B.
5. If A is greater than B, then the first person is elder.
6. If B is greater than A, then the second person is elder.
7. If A is equal to B, then both persons are of the same age.
8. Output the result indicating who is elder.
9. STOP

8. write an algorithm which will ask for two number and the output will be
bigger no is, smaller number is

Answer:

1. START
2. Input the first number and store it in variable A.
3. Input the second number and store it in variable B.
4. Compare the numbers A and B.
5. If A is greater than B, then output "Bigger number is A" and "Smaller
number is B."
6. If B is greater than A, then output "Bigger number is B" and "Smaller
number is A."
7. If A is equal to B, then output "Both numbers are equal."
8. STOP
9. write an algorithm which will ask for 4 different no. and find out the biggest one

Answer:

1. START
2. Input the first number and store it in variable A.
3. Input the second number and store it in variable B.
4. Input the third number and store it in variable C.
5. Input the fourth number and store it in variable D.
6. Assume A is the biggest number and store it in variable Biggest.
7. If B is greater than Biggest, update Biggest to B.
8. If C is greater than Biggest, update Biggest to C.
9. If D is greater than Biggest, update Biggest to D.
10. Output "The biggest number is Biggest."
11. STOP

10. write an algorithm where the computer will ask for two numbers and it
will print lowest one

Answer:

1. START
2. Input the first number and store it in variable A.
3. Input the second number and store it in variable B.
4. Compare the numbers A and B.
5. If A is less than B, then output "The lowest number is A."
6. If B is less than A, then output "The lowest number is B."
7. If A is equal to B, then output "Both numbers are equal."
8. STOP

11. write an algorithm where the computer will ask for two numbers and it
will print bigger one

Answer:

1. START
2. Input the first number and store it in variable A.
3. Input the second number and store it in variable B.
4. Compare the numbers A and B.
5. If A is greater than B, then output "The bigger number is A."
6. If B is greater than A, then output "The bigger number is B."
7. If A is equal to B, then output "Both numbers are equal."
8. STOP

You might also like