Guest User

Untitled

a guest
Oct 22nd, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. public class IsSequence {
  2. public static void main(String[] args) {
  3. int arr1[]={1,2,3};
  4. int arr2[]={5,5,3};
  5. int arr3[]={1,1,3};
  6. voz(arr1);
  7. voz(arr2);
  8. voz(arr3);
  9. if (voz(arr1) == true) {
  10. System.out.println("yes");
  11. } else {
  12. System.out.println("no");
  13. }
  14. if (voz(arr2) == true) {
  15. System.out.println("yes");
  16. } else {
  17. System.out.println("no");
  18. }
  19. if (voz(arr3) == true) {
  20. System.out.println("yes");
  21. } else {
  22. System.out.println("no");
  23. }
  24.  
  25. }
  26.  
  27. public static boolean voz(int[] arr) {
  28. boolean voz = true;
  29. for (int i = 0; i < arr.length - 1; i++) {
  30. if (arr[i] < arr[i + 1]) {
  31. voz = true;
  32. } else voz = false;
  33. break;
  34. }
  35. return voz;
  36. }
  37. }
Add Comment
Please, Sign In to add comment