Ascending Order

4.Ascending Order


Write a program to find whether the given array is sorted in ascending order.

Input Format:
Input consists of n+1 integers. The first integer corresponds to ‘n’ , the size of the array. The next ‘n’ integers correspond to the elements in the first array. Assume that the maximum value of n is 15.
Output Format:
Print yes if the array is sorted in asecending order. Print no if the array is not sorted in ascending order.
Sample Input 1:
5
2
3
6
8
1

 
Sample Output 1:
no

 
Sample Input 2:
5
2
3
6
8
10

 
Sample Output 2:
yes


code:


No comments:

Post a Comment