1.

WritePrograms that read two numbers andPrint the largest number​

Answer»

Program to find the GREATEST of two NUMBERS and greatest of three numbers is discussed here. Input two or integers from the user and find the greatest number AMONG them.



Input & Output FORMAT:



Input consists of 2 integers.



Sample Input and Output :

7

9

5

9 is greater.


Algorithm to find the greatest of two numbers and greatest of three numbers


Greatest_of_two_numbers(num1, num2):



If (num1 > num2)
Print num1
Else, print num2


Greatest_of_three_numbers(num1,num2):



If (num1 > num2) and (num1 > num3)
Print num1
Else if (num2 > num1) and (num 2 > num3)
Print num2.
Else, print num3



Discussion

No Comment Found