Problem2186--Finding unordered numbers

2186: Finding unordered numbers

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 0  Solved: 0
[Submit] [Status] [Web Board] [Creator:]

Description

Consider the declaration double a[10] = {1.2, 2.1, 3.3, 3.5, 4.5, 7.9, 5.4, 8.7, 9.9, 1.0}; Write a function named out_of_order that will test this array for the condition a[0] <= a[1] <= a[2] <= ... The function returns a -1 if the elements are not out of order, otherwise it returns the index of the first element that is out of order.

Input

10 values

Output

-1 if the elements are not out of order, otherwise it returns the index of the first element that is out of order.E6

Sample Input Copy

1.2, 2.1, 3.3, 3.5, 4.5, 7.9, 5.4, 8.7, 9.9, 1.0

Sample Output Copy

6

Source/Category

14