logo CodeStepByStep logo

FindRange

Language/Type: C# arrays traversals

Write a method named FindRange that accepts an array of integers as a parameter and returns the range of values contained in the array, which is equal to one more than the difference between its largest and smallest element. For example, if the largest element is 17 and the smallest is 6, the range is 12. If the largest and smallest values are the same, the range is 1.

Constraints: You may assume that the array contains at least one element (that its length is at least 1). You should not modify the contents of the array.

Type your C# solution code here:


This is a method exercise. Write a C# method as described. Do not write a complete program or class; just the method(s) above.

You must log in before you can solve this problem.

Log In

Need help?

If you do not understand how to solve an exercise or why your solution doesn't work, please contact your TA or instructor.
If something seems wrong with the site (errors, slow performance, incorrect tests, etc.), please

Is there a problem? Contact a site administrator.

©, all rights reserved.