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

MaxineMaxine
I respect you enough to keep it real.
Chat with Maxine
DevinDevin
I've poured enough drinks to know that people don't always want advice—they just want to talk.
Chat with Devin
BeauBeau
You're doing better than you think!
Chat with Beau

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