C++ Exercises: Compute the difference between the largest and smallest values in a given array of integers and length one or more
Difference Between Largest and Smallest Values in Array
Write a C++ program to compute the difference between the largest and smallest values in a given array of integers and length one or more.
Sample Solution:
C++ Code :
Sample Output:
11 10
Visual Presentation:

Flowchart:

For more Practice: Solve these Related Problems:
- Write a C++ program to identify the maximum and minimum values in an array and compute their difference.
- Write a C++ program that reads an array of integers, finds its largest and smallest elements, and outputs the difference.
- Write a C++ program to determine the range (difference between maximum and minimum) of an input array of numbers.
- Write a C++ program that processes an array and prints the difference between its highest and lowest values.
C++ Code Editor:
Contribute your code and comments through Disqus.
Previous: Write a C++ program to count even number of elements in a given array of integers.
Next: Write a C++ program to compute the sum of values in a given array of integers except the number 17. Return 0 if the given array has no integer.
What is the difficulty level of this exercise?