Pseudocode and Algorithm to find Largest of 2 numbers

[3772 views]


In this post, we will be learning how to find a maximum or largest number between 2 numbers taken as an 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
        


Need Programming or any Technical Related Books, Courses or Help Chat with us

Myntra [CPS] IN

Comments

1 comment
  • Alex

    What about psedocode for the problem...?



Sponsored Advertisement


Udemy WW



Norton [CPS] WW

Search
Online Games
Play 2048 Game Online and Relax.
Play 2048 Game Online


Search Tags

    Algorithm for Maximum of 2 numbers

    Find Maximum of two numbers algorithm

    Find Largest of 2 numbers algorithm

    Pseudocode to find Largest of two numbers