# What is the algorithm to find the greatest of two numbers?

## What is the algorithm to find the greatest of two numbers?

Algorithm to find the greatest of two numbers Read the two integer values in num1 and num2 (integer variables). Check if num1 is greater than num2. If true, then print ‘num1’ as the greatest number. If false, then print ‘num2’ as the greatest number.

## How do you find the largest number in an algorithm?

Algorithm to find greatest number of three given numbers

1. Ask the user to enter three integer values.
2. Read the three integer values in num1, num2, and num3 (integer variables).
3. Check if num1 is greater than num2.
4. If true, then check if num1 is greater than num3.
5. If false, then check if num2 is greater than num3.
READ ALSO:   What happens to married couples after death?

What is an algorithm what is the need for an algorithm?

An algorithm is a set of step-by-step procedures, or a set of rules to follow, for completing a specific task or solving a particular problem.

What is an algorithm in math?

: a procedure for solving a mathematical problem (as of finding the greatest common divisor) in a finite number of steps that frequently involves repetition of an operation broadly : a step-by-step procedure for solving a problem or accomplishing some end There are several search engines, with Google, Yahoo and Bing …

### Is there an algorithm to compare two arbitrary numbers?

It is tricky indeed to find an algorithm to compare two arbitrary numbers. It is trivial if you restrict both numbers to a single set which has a well-defined and commonly accepted “>” function applicable to this given pair, otherwise you needs must create a “greater than” function yourself over the domain of the two types of numbers.

### When does the algorithm return the greatest common divisor of original numbers?

If the remainder is equal to 0, then the algorithm returns value stored in B (it is the greatest common divisor of original numbers A and B ). Find the greatest common divisor of numbers 133 and 15?

READ ALSO:   Why do angles in a circle add up to 360 degrees?

How do you find the greatest common divisor of two numbers?

Hence we use the Euclidean algorithm ( Euclid’s algorithm) to calculate the greatest common divisor of two natural numbers. The Euclidean algorithm does not require any factorization at all. The Euclidean algorithm takes as an input two positive integers A and B and assumes that ( denotes a modulo operation).

How to find largest of 2 numbers in Excel?

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