Algorithm to compare two numbers and find the greater one
Answers
Answer:
The answer is Yes. At present, I am enrolled into 100 day Expert Coder course and I am finding it really Helpful. They are preparing us for competitive programing. They have made(Continue reading)
4 Answers
Tony Howell, Global Manager Machinery & Equipment (2005-present)
Answered April 30
Algorithms can be tricky. One of the trickiest parts is the assumptions behind your instructions. Check out this video of children trying to write an algorithm for Peanut Butter & Jelly Sandwich :
As mentioned elsewhere a simple one is :
Given number A & B.
Evaluate A - B to get C (C=B-A)
If C > 0 then A is Greater
If C = 0 then they are the same number, neither is Greater
If C < 0 then B is Greater
I had a Math Course on Algorithms and we had to create computer programs based on those Algorithms. It was interesting to compare them in the different languages.
Someone
Related Questions
More Answers Below
What is the algorithm for finding the greatest of three numbers?
What is an algorithm for biggest two numbers?
What is an algorithm to find the greatest in five numbers?
How does an algorithm show the largest of any three numbers?
What is the algorithm for even or odd number c programming?
Pavel Krajcovic, studied Computer Science & Computer Programming at Palacký University, Olomouc
Answered May 1
let’s say you have 2 numbers “a” and “b”.
if a > b:
print "a is bigger"
elif a<b:
print "b is bigger"
else:
print "both numbers are equal"
632 viewsView 2 Upvoters
Sponsored by Dell
New Vostro 3000 series for small businesses.
Better tools for quicker results. Starting at Rs. 36,990*.
Roger Walter, Textbook and Journal Editor
Answered April 28 · Author has 52 answers and 8.5K answer views
Come on! Anyway if the numbers are a and b, calculate a - b. If it’s negative, a<b, if it’s positive, a>b, if zero, a=b
433 viewsView 1 Upvoter
Ellis Cave, BSEE Electrical and Electronics Engineering & Computer Science, University of Kansas (1969)
Answered April 29 · Author has 4K answers and 1.1M answer views
In J, the “Larger Of” symbol is >.
5 >. 7
7
20 >. 19
20
21 >. 4 >. 16 >. 39 >. 31 >. 17 >. 6
39
is the same as:
>./21 4 16 39 31 17 6
39
338 views
Related Questions
What is the algorithm for finding the greatest of three numbers?
What is an algorithm for biggest two numbers?
What is an algorithm to find the greatest in five numbers?
How does an algorithm show the largest of any three numbers?
What is the algorithm for even or odd number c programming?
How do I convert an algorithm into a flowchart to find the greatest of three numbers?
What is the algorithm to find the largest number and the smallest number?
What are the three numbers of algorithm?
What is an algorithm to get the average of three (3) numbers?
What is the best algorithm to find least difference of two numbers in an array?
What is an algorithm? Write an algorithm to find the smallest number between any three given numbers.
What is the Flowchart for finding Greatest of 3 Integers?
What is the algorithm to find the greatest number between 10 numbers?
What is the flowchart to find the largest number in an n-number?
What is an algorithm to find the biggest number in any given three numbers?
Related Questions
What is the algorithm for finding the greatest of three numbers?
What is an algorithm for biggest two numbers?
What is an algorithm to find the greatest in five numbers?
Explanation:
Step 1: Input two numbers and store them in A.
and B.
Step 2: Check whether A=B. If true then go to
step 3,else go to step 4.
Step 3: Print "Both numbers are equal" and stop.
Step 4: Conpare A and B. If A is greater than B,
go to step 5, else go to step 6
Step 5: Print "A is greater" and stop.
Step 6: Print "B is greater" and stop.