Answer to Question #298817 in C++ for aiman

Question #298817

Construct a pseudo code and flowchart which reads in two integer values. Then display all the numbers that is located between two numbers. If the first number entered is smaller than the second number entered, print all numbers in ascending order. On the other hand, if the first number entered is greater than the second number entered, print all numbers in descending order. Example: Input : 3 7 Output : 3 4 5 6 7 Input : 7 3 Output : 7 6 5 4 3


1
Expert's answer
2022-02-17T02:13:33-0500




function main()
    output "Enter the first number:"
    input firstNumber
    output "Enter the second number:"
    input secondNumber
    if firstNumber < secondNumber then
        loop i from firstNumber to secondNumber
            output i
        end loop
    else
        loop i from firstNumber to secondNumber step -1
            output i
        end loop
    end If
end function

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog