In this tutorial, we are going to write an algorithm to find the maximum of two numbers. using this algorithm we can write a program to find the Maximum of two numbers in most programming languages like C, C++, Python, and Java programming.
Algorithm to find the Maximum of two numbers.
1. Read A and B.
2. If A > B, then
3. Set MAX:=A.
4. Else:
5. Set MAX:=B.
6. [End of If structure]
7. Write MAX.
8. Exit
In the above-given algorithm first, we read two numbers A and B. and then we check if A is greater than B then we set the value of A to the MAX variable else we set the value of B to the MAX variable. after that, we write the value of MAX on the output screen and then Exit from the program.
Remember that an algorithm always gives the steps to write a program.
Also, Read
- Algorithm to Add [Sum] two numbers
- Algorithm to Find Maximum of Three Numbers
- Algorithm to Input percentage From user and Print grade
- Algorithm to Print the Series 1 to N using for loop
- Algorithm to Print the Series 1 to N using while loop
- Algorithm to Print the Series 1 to N using Do While loop
- Algorithm to Reverse a given Number
- Algorithm to Find Whether a Number is Prime or Not
- Algorithm for Linear Search in Array
- Algorithm to Calculate Factorial using Function