answersLogoWhite

0

'*** PROGRAM: Compare 2 numbers using both min/max functions;

' then, output which number is max/and, which is min.

'*** declare variables...

min = 0

max = 0

number1 = 342

number2 = 256

'*** main program...

CLS '...(CL)ear the Output (S)creen

PRINT "Minimum = "; findMin(number1, number2)

PRINT "Maximum = "; findMax(number1, number2)

END '...END of program/halt program code execution

FUNCTION findMax (num1, num2)

answer = 0

IF num1 > num2 THEN answer = num1 ELSE answer = num2

findMax = answer

END FUNCTION

FUNCTION findMin (num1, num2)

answer = 0

IF num1 < num2 THEN answer = num1 ELSE answer = num2

findMin = answer

END FUNCTION

---program output...

Minimum: 256

Maximum: 342

User Avatar

Wiki User

12y ago

Still curious? Ask our experts.

Chat with our AI personalities

CoachCoach
Success isn't just about winning—it's about vision, patience, and playing the long game.
Chat with Coach
BlakeBlake
As your older brother, I've been where you are—maybe not exactly, but close enough.
Chat with Blake
RossRoss
Every question is just a happy little opportunity.
Chat with Ross

Add your answer:

Earn +20 pts
Q: How do you find the minimum and the maximum of a function?
Write your answer...
Submit
Still have questions?
magnify glass
imp