Question

In: Computer Science

CORAL LANGUAGE ONLY Write a program whose inputs are three integers, and whose outputs are the...

CORAL LANGUAGE ONLY

Write a program whose inputs are three integers, and whose outputs are the largest of the three values and the smallest of the three values. If the input is 7 15 3, the output is: largest: 15 smallest: 3 Your program should define and call two functions: Function LargestNumber(integer num1, integer num2, integer num3) returns integer largestNum Function SmallestNumber(integer num1, integer num2, integer num3) returns integer smallestNum The function LargestNumber should return the largest number of the three input values. The function SmallestNumber should return the smallest number of the three input values.

Solutions

Expert Solution

Here is the completed code for this problem. Comments are included, go through it, learn how things work and let me know if you have any doubts or if you need anything to change. If you are satisfied with the solution, please rate the answer. If not, PLEASE let me know before you rate, I’ll help you fix whatever issues. Thanks

Note: Please maintain proper code spacing (indentation), just copy the code part and paste it in your compiler/IDE directly, no modifications required.

Function LargestNumber(integer num1, integer num2, integer num3) returns integer largestNum
   //if num1 is bigger than num2 and num3, setting it as largestNum
   if num1>=num2 and num1>=num3
      largestNum=num1
   //if num2 is bigger, setting it as largestNum
   elseif num2>=num1 and num2>=num3
      largestNum=num2
   //otherwise setting num2 as largestNum
   else
      largestNum=num3

Function SmallestNumber(integer num1, integer num2, integer num3) returns integer smallestNum
   //just like previous function, we find smallestNum
   if num1<=num2 and num1<=num3
      smallestNum=num1
   elseif num2<=num1 and num2<=num3
      smallestNum=num2
   else
      smallestNum=num3

Function Main() returns nothing
   //declaring integers
   integer num1
   integer num2
   integer num3
   integer largest
   integer smallest
   //reading three values
   num1 = Get next input
   num2 = Get next input
   num3 = Get next input
   //finding largest and smallest
   largest=LargestNumber(num1,num2,num3)
   smallest=SmallestNumber(num1,num2,num3)
   //printing both
   Put "Largest: " to output
   Put largest to output
   Put "\nSmallest: " to output
   Put smallest to output
   //add a Put statement to print "\n" if your program
   //expects a newline at the end.

OUTPUT


Related Solutions

in coral write a program whose inputs are three integers, and whose output is the largest...
in coral write a program whose inputs are three integers, and whose output is the largest of the three values. Ex: If the input is 7 15 3, the output is: 15
Code in C Write a program whose inputs are three integers, and whose outputs are the...
Code in C Write a program whose inputs are three integers, and whose outputs are the largest of the three values and the smallest of the three values. Ex: If the input is: 7 15 3 the output is: largest: 15 smallest: 3 Your program must define and call the following two functions. The LargestNumber function should return the largest number of the three input values. The SmallestNumber function should return the smallest number of the three input values. int...
Write a program whose inputs are three integers, and whose outputs are the largest of the three values and the smallest of the three values.
 in Coral Simulator  Write a program whose inputs are three integers, and whose outputs are the largest of the three values and the smallest of the three values. If the input is 7 15 3, the output is: largest: 15 smallest: 3 Your program should define and call two functions: Function LargestNumber(integer num1, integer num2, integer num3) returns integer largestNum Function SmallestNumber(integer num1, integer num2, integer num3) returns integer smallestNum The function LargestNumber should return the largest number of the...
Write a program Write a program whose inputs are three integers, and whose output is the...
Write a program Write a program whose inputs are three integers, and whose output is the smallest of the three values. Ex: If the input is: 7 15 3 the output is: 3 C++ please
Write a program whose inputs are three integers, and whose output is the smallest of the...
Write a program whose inputs are three integers, and whose output is the smallest of the three values
Write a program whose inputs are three integers, and whose output is the smallest of the...
Write a program whose inputs are three integers, and whose output is the smallest of the three values. Use else-if selection and comparative operators such as '<=' or '>=' to evaluate the number that is the smallest value. If one or more values are the same and the lowest value your program should be able to report the lowest value correctly. Don't forget to first scanf in the users input. Ex: If the input is: 7 15 3 the output...
Program must be in Python Write a program in Python whose inputs are three integers, and...
Program must be in Python Write a program in Python whose inputs are three integers, and whose output is the smallest of the three values. Input is 7 15 3
CORAL Language Only: Write a program that first gets a list of six integers from input....
CORAL Language Only: Write a program that first gets a list of six integers from input. The first five values are the integer list. The last value is the upper threshold. Then output all integers less than or equal to the threshold value. Ex: If the input is 50 60 140 200 75 100, the output is: 50 60 75 For coding simplicity, follow every output value by a space, including the last one. Such functionality is common on sites...
Write a program whose inputs are two integers, and whose output is the smallest of the...
Write a program whose inputs are two integers, and whose output is the smallest of the two values. Ex: If the input is: 7 15 output is: 7 passed through command line *in python
7.3 Loops: Output range with increment of 10 IN CORAL LANGUAGE zyBooks Write a program whose...
7.3 Loops: Output range with increment of 10 IN CORAL LANGUAGE zyBooks Write a program whose input is two integers, and whose output is the first integer and subsequent increments of 10 as long as the value is less than or equal to the second integer. Ex: If the input is -15 30, the output is: -15 -5 5 15 25 Ex: If the second integer is less than the first as in 20 5, the output is: Second integer...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT