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

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

The program to find the greatest of two numbers and the 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 the greatest of three numbers

Greatest_of_two_numbers(num1, num2):

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


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


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

The program to find the greatest of two numbers and the greatest of three numbers is given below :


Program to find the greatest of two numbers

@@coding::1@@


Program to find the greatest of three numbers

@@coding::2@@



Recommended Programs


Program to find the number of days in a given month of a given year

c