Java Program to Print Numbers from 1 to 100 without using Loop

Write a java program to print numbers from 1 to 100 without using loop.  This is a very interesting and tricky problem for beginners. You have to think how to solve this problem without using loop.

This problem can be easily solved using loop, (for and while loop).  So, how do you solve this problem without using loop? The answer is using recursion.

So, In this tutorial, we are going to solve this problem using recursion.

Subscribe Our Tutorials

Get Latest Updates on Facebook

Java Program to Print Numbers from 1 to 100 without using Loop

Java Program to Print Numbers from 1 to 100 without using Loop

Java Program to Print Numbers from 1 to 100 without using Loop

In this example, we are going to write a java code which prints 1 to 100 numbers using recursion. In this code, we have created one method printNum which takes  integer as an argument. Inside a method we are checking one condition and calling a printNum method recursively.

C programming questions for practice

Java programs

About WebRewrite

I am technology lover who loves to keep updated with latest technology. My interest field is Web Development.
Tagged , . Bookmark the permalink.