Computer Science, asked by prince578228, 1 year ago

write an algorithm to read two numbers then display the large number.

Answers

Answered by ayesha6054
25
(1) read first number 
(2) read second number 
(3) if first is greater, display second, else display first 

The second and third can be done the same way: 

(1) read first number and set highestSeenSoFar to it 
(2) read another number, and if greater than highestSeenSoFar, set highesSeenSoFar to the new number 
(3) repeat step 2 (twice for 3 numbers total, 99 times for 100 numbers) 
(4) display highestSeenSoFar 
Answered by BBSMSPDSPPS
10
HEY FRIEND HERE IS YOUR ANSWER

DONT FORGET TO MARK ME BRAINLIEST

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.
Similar questions