fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int arr[10];
  5. int isValley = 0;
  6.  
  7. printf("Enter 10 integers:\n");
  8. for (int i = 0; i < 10; i++) {
  9. scanf("%d", &arr[i]);
  10. }
  11.  
  12. // Check from index 1 to 8
  13. for (int i = 1; i < 9; i++) {
  14. if (arr[i] < arr[i - 1] && arr[i] < arr[i + 1]) {
  15. isValley = 1;
  16. break;
  17. }
  18. }
  19.  
  20. if (isValley)
  21. printf("Valley\n");
  22. else
  23. printf("No Valley\n");
  24.  
  25. return 0;
  26. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
Enter 10 integers:
Valley