217k views
4 votes
Write a Coral program that outputs the low and high values from a list of non-negative integers. The list ends with -1, which is not part of the list. If the input is 100 100 99 80 95 63 70-1, the output is Range: 63 to 100 If the input is 5-1 (the list has only one value), the output is: Range: 5 to 5 If the list is -1 (the list has no values), the output is: Range: none

User InternalFX
by
8.0k points

1 Answer

4 votes
Sure! Here's a Coral program that takes a list of non-negative integers and outputs the low and high values:

```
process RangeFinder {

input collection: Pipe
output range: Pipe

var min: Integer = 9999
var max: Integer = 0

loop (number in collection) {
if (number == -1) {
break
}

if (number
User Mukesh Gupta
by
8.2k points

No related questions found