# How do you print numbers from 1 to 10 without a loop?

## How do you print numbers from 1 to 10 without a loop?

Show activity on this post. public void recursiveMe(int n) { if(n <= 10) {// 10 is the max limit System. out. println(n);//print n recursiveMe(n+1);//call recursiveMe with n=n+1 } } recursiveMe(1); // call the function with 1.

## How will you print numbers from 1 to 100 without using a loop in C?

How to Print 1 to 100 without using Loop in C programming?

1. Using 100 printf Statements!!! Yes this is also a solution, you can use 100 printf statements one after another.
2. Print 1 to 100 Using Recursion.
3. Print 1 to 100Using goto Statement.
4. Using seq Command on Linux.

Can you do a loop without a loop?

Write a program that accepts input for a number from the user then prints a message that number of times WITHOUT using a loop construct, i.e do/do-while/for/foreach explicitly.

### How can I print 100 numbers without loop in SQL Server?

Query

1. ; with CTE as.
2. (
3. select 1 Number.
4. union all.
5. select Number +1 from CTE where Number<100.
6. )
7. select *from CTE.

### How do I print my name 1000 times without looping?

How do I print my name 1000 times in Java without looping?

1. Using the concept of recursion: public class MyClass { private static void printName(int n) { if (–n > 0) { System.out.println(“My Name”); printName(n); } } public static void main(String args[]) { printName(1000); } }
2. +22.
3. +12.
4. +10.
5. +8.
6. +5.
7. +2.

How do you print 1 to n using recursion?

Inside display() function We check if number is not zero, in that case we call the same function display() recursively and pass (num-1) to it. In the else block we write the base condition, that is, return the control back to the calling function if num is 0. This prints the natural numbers from 1 to user input limit.

#### What can be used instead of for loop?

There are other array utility methods like every , slice , splice , some , concat , sort which everyone should be aware of. Using the right kind of function not only makes the code cleaner, but it also makes it easy to test and extend. Plus you are writing futuristic code by using these functions.

#### How can I print Hello World 1000 times without using loop?

For example take a c program to do this job.

1. #include
2. void main(){
3. int counter=1;
4. print(“statement %d”,counter);
5. if(counter==1000)
6. return;
7. counter++;
8. main();

How do I print numbers from 1 to 100 in SQL?

## How to print numbers from 1 to 100 without using for loop?

We declared a recursive function in this Go program to print numbers from 1 to 100 without using for loop. Here, printNumbers (num + 1) calls the printNumbers () function recursively.

## How to print a number that is less than 100 in Python?

In this example, we have a function, printnum (), to print a number of the number is less than or equal to 100. Additionally it calls itself with the next number. The function, printnum (), is called from main with 1. The function, printnum (), will print 1 first and then will call itself by 2.

How to print a number from 1 to 100 using recursion?

Yes recursion is an option to do repetitive work. here is the C program to print 1 to 100 using recursion. In this example, we have a function, printnum (), to print a number of the number is less than or equal to 100. Additionally it calls itself with the next number.

### Is there a way to print more than 1000 numbers using printf?

Obviously this is not a good solution because you have to write the printf statements so many times. Even worse thing is: if you want to print 1000 numbers, you have to write the printf statement 1000 times. It is not scalable at all.