Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Project: Exam_101_January_2016 - created by borkins on 2017-05-03.
- */
- import java.util.Scanner;
- public class _11_IncreasingFourNumbers
- {
- public static void main(String[] args)
- {
- Scanner console = new Scanner(System.in);
- int a = Integer.parseInt(console.nextLine());
- int b = Integer.parseInt(console.nextLine());
- int n1;
- int n2 = a + 1;
- int n3 = a + 2;
- int n4 = a + 3;
- if (Math.abs(a - b) >= 3)
- {
- for (n1 = a; n1 <= n2 - 1; n1++)
- {
- for (n2 = n1 + 1; n2 <= n3 - 1; n2++)
- {
- for (n3 = n2 + 1; n3 <= n4 - 1; n3++)
- {
- for (n4 = n3 + 1; n4 <= b; n4++)
- {
- System.out.printf("%d %d %d %d%n", n1, n2, n3, n4);
- }
- }
- }
- }
- }
- else {
- System.out.println("No");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment