Program Description
Write a java program to print 1 to 10 without using any loop.This can be achieved by using recursion in java.Following is the sample code.
package com.devglan.set2; public class Print { public static void printWithoutLoop(int n) { if (n <= 10) { System.out.println(n); printWithoutLoop(n + 1); } } public static void main(String[] args){ Print.printWithoutLoop(1); } }