answersLogoWhite

0

Write an algorithm to read two numbers then display the largest?

Updated: 9/21/2021
User Avatar

zakir khan

Lvl 2
βˆ™ 2y ago

Best Answer

Read 2 numbers. If first is larger than second, display second, else display first.

That's for the smallest. For the largest reverse the two.

For each of the other two, it's easier to just create a variable, call it largest. Initialize it to a very small number, say -1. As you read each number, compare it to largest. If the number is larger than largest, set largest equal to the number. When you finish each list of numbers, then print largest.

Best answer

Read 2 numbers. If first is larger than second, display second, else display first.

That's for the smallest. For the largest reverse the two.

For each of the other two, it's easier to just create a variable, call it largest. Initialize it to a very small number, say -1. As you read each number, compare it to largest. If the number is larger than largest, set largest equal to the number. When you finish each list of numbers, then print largest.

User Avatar

zakir khan

Lvl 2
βˆ™ 2y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write an algorithm to read two numbers then display the largest?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Design step by steps algorithm on how to write the letter A and display the result?

Design step by steps algorithm on how to write the letter A and display the result


Write an algorithm and draw a corresponding flowchart to search a number in the given list of numbers and also display its position?

please give me an algorithm and a corresponding flow chart that displays list of numbers from 1 to 20.


How to write an algorithm that accepts five numbers and displays the sum and average of the numbers?

1.Start Algorithm 2.Enter first number 3.Enter second number 4.Enter third number 5.Enter fourth number 6.Enter fifth number 7.Add five number 8.display five number / 2 9.Display result 10.End Algorithm


Can you write an algorithm to find the beast numbers?

maybe


Write algorithm compute sum of square of N numbers?

1. Design an algorithm to compute sum of the squares of n numbers?


Write an algorithm to check whether a number is a prime number or not?

You can write out this algorithm. This will then be programmed into the device to make determining prime numbers easier.


Write an Assembly language program which implements sorting algorithm both ascending and descending order and display those numbers with certain delay say of 5sec between successive displays?

das


Write an algorithm or draw a flowchart to display numbers from 100 down to 10?

n=100 loop until n = 9 print n n = n -1 end loop


How can I write a program to display prime numbers from 1 to 100?

Write a function that implements an algorithm that checks to see if a particular integer is prime (returning a boolean). Write a program that uses that function on each number from 1 to 100, and if true, displays that number.


Write algorithm and draw flowchart to find the sum of even numbers?

jgfujtf


Write a algorithm and flowchart to find largest among N numbers?

Max = 0For K = 1 to NIf Number(K) > Max then Max = Number(K)Next KPrint Max


Write an algorithm to calculate the area of a circle and display the result . Use the formulae A=ΒΆr where ΒΆ is equal to 3.1416?

10001/999900