Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main
- {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- System.out.print("Enter \"a\" here: ");
- int a = Integer.parseInt(sc.nextLine());
- System.out.print("Enter \"b\" here: ");
- int b = Integer.parseInt(sc.nextLine());
- int count = 0;
- 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 h = k+1;h<=b;h++){
- System.out.println(String.format("%d %d %d %d",i,j,k,h));
- count++;
- }
- }
- }
- }
- if(count == 0){
- System.out.println("No");
- }
- }
- }
Add Comment
Please, Sign In to add comment