Pseudocode and Algorithm to find Largest of 2 numbers


In this post, we will be learning how to find a maximum or largest number between 2 numbers taken as an input.

Input num1: 10
Input num2: 20

Maximum = 20

Pseudocode to find Maximum of 2 numbers :

READ n1,n2 IF n1>n2 WRITE "n1 is Maximum" ELSE WRITE "n2 is Maximum" ENDIF

In the above pseudocode, we first take two number inputs from user and store the number in n1 and n2. Then check whether n1 is greater than n2. If n1 is greater than n2, then Print "n1 is max", else Print "n2 is max"

Algorithm to find Largest of 2 numbers :

Step 1: Start Step 2: Declare variables n1, n2 Step 3: If n1 is greater than n2, Display "n1 is Maximum" else Display "n2 is Maximum" Step 4: Stop

Solution Worked 8 UpvotesUpvote


Solution Didn't Worked 7 DownvotesDownvote


Get Programming Help

Play 2048 Game Online

Search Tags

    Algorithm for Maximum of 2 numbers

    Find Maximum of two numbers algorithm

    Find Largest of 2 numbers algorithm