+ 1

How do i create a program that outputs the maximum value of a range of values

6th Nov 2016, 9:40 AM
Benjamin
2 Respostas
0
take an array of nos. int main() { int a[10]; int max=a[0]; for(int i=1;i<10;i++){ if(max < a[i]) max = a[i]; } cout<<max; }
6th Nov 2016, 9:58 AM
kamal joshi
kamal joshi - avatar
- 1
Well if it's a range like M..N(M to N) isn't N the largest number ? Assuming that this range is not a range and is rather a list of numbers then, use quicksort(Google it's C++ implementation) and display the last number in the array
6th Nov 2016, 9:59 AM
Paul Kabira
Paul Kabira - avatar