Wednesday 8 October 2014

Print 1 to 10 numbers without loop in Java

Structure of the Problem Requirements 

In this problem we will learn how to print 1 to 10 numbers without loop in Java. Before this tutorial we upload how to print 1 to 100 numbers without loop in C++. We used Recursive function which call itself again and again to print 1 to 10 numbers. Here is the source code of this problem which help you in better understanding.

Source Code 



public class recursionfun {

public static void main(String[] args) {
System.out.print("\t \t \t LEP Tutorials \n \n ");
int a = 1;
start(a);
}
public static void start (int s)
{
if (s<=10)
{
System.out.print(" \n " + s);
start(s+1);
}
}
}

Output of the Program

Print 1 to 10 Number without Loop in Java
Print 1 to 10 Number without Loop in Java


Share it Please
asad

About Author!

Asad Niazi is Software Engineer , Programmer, Web Developers and a young mentor of Tech Solutions Desk and Blogging Solutions . Asad Love to writes about Technology, Programming, Blogging and make money online.

1 comments: Post Yours! Read Comment Policy!▼
Important Note:
We have Zero Tolerance to Spam. Chessy Comments and Comments with Links will be deleted immediately upon our review.

  1. Is there any alternative way of doing this ??? Because Recursive function is little bit difficult to understand for the Beginners level student complexity of Recursive function ???

    ReplyDelete