Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.Ch1_ArraysAndStrings;
- import java.util.Scanner;
- public class FourNumbers {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int a = Integer.parseInt(scan.nextLine());
- int b = Integer.parseInt(scan.nextLine());
- boolean printedAny = false;
- for (int i = a; i <= b; i++) {
- for (int j = i+1; j <=b ; j++) {
- for (int k = j+1; k <=b ; k++) {
- for (int l = k+1; l <=b ; l++) {
- printedAny = true;
- System.out.printf("%d %d %d %d\n",i,j,k,l);
- }
- }
- }
- }
- if (!printedAny){
- System.out.println("No");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement