Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int a = scanner.nextInt();
- boolean flag = false;
- boolean asc = true;
- while(scanner.nextInt() != 0)
- {
- int b = scanner.nextInt();
- if (b >= a && asc == true)
- {
- a = b;
- flag = true;
- asc = true;
- continue;
- }
- else
- {
- asc = false;
- }
- if (b <= a && asc == false)
- {
- a = b;
- flag = true;
- continue;
- }
- else
- {
- flag = false;
- break;
- }
- }
- System.out.println(flag);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement