Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class IsSequence {
- public static void main(String[] args) {
- int arr1[]={1,2,3};
- int arr2[]={5,5,3};
- int arr3[]={1,1,3};
- voz(arr1);
- voz(arr2);
- voz(arr3);
- if (voz(arr1) == true) {
- System.out.println("yes");
- } else {
- System.out.println("no");
- }
- if (voz(arr2) == true) {
- System.out.println("yes");
- } else {
- System.out.println("no");
- }
- if (voz(arr3) == true) {
- System.out.println("yes");
- } else {
- System.out.println("no");
- }
- }
- public static boolean voz(int[] arr) {
- boolean voz = true;
- for (int i = 0; i < arr.length - 1; i++) {
- if (arr[i] < arr[i + 1]) {
- voz = true;
- } else voz = false;
- break;
- }
- return voz;
- }
- }
Add Comment
Please, Sign In to add comment