In this example, i’ll show you How do you print numbers from 1 to 100 without using loop in Java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
// Java program to count all pairs from both the // linked lists whose product is equal to // a given value class c4e { static int i = 1; public static void main(String[] args) { if (i <= 100) { System.out.printf("%d ", i++); main(null); } } } // This code is contributed by Rajput-Ji |