Pseudocode and Algorithm to find Largest of 2 numbers

(140 Views)


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

Example:
Input:
Input num1: 10
Input num2: 20

Output:
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 3 UpvotesUpvote

        

Solution Didn't Worked 1 DownvotesDownvote



Comments



Search