Algorithm
Algorithm
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
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