nguyenhappy92

Dãy tăng nghiêm ngặt

Dec 10th, 2015
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. // Day tang nghiem ngat
  2. // khai bao cac ham thu vien neu co
  3. #include<stdio.h>
  4. #include<conio.h>
  5. void main()
  6. {
  7.  
  8. int n, A[199],d=0;
  9. scanf("%d",&n);
  10. for (int i = 0; i < n; i++)
  11. {
  12. scanf("%d",&A[i]);
  13. if( A[i -1] >= A[i] )// day khong nghiem ngat
  14. {
  15. printf("%d",i );break;
  16. }
  17. else
  18. d++;
  19. }
  20. if(d == n)
  21. printf("-1");
  22. }
Advertisement
Add Comment
Please, Sign In to add comment