+ 1
How do I print my name 1000 times in Java without looping?
Question about a program.
10 Respostas
+ 22
System.out.print(
String.format("%1000s", " ")
.replace(" ", "*** My Name!:) ***\n") );
+ 11
Type System.out.println(name); 1000 times
+ 11
voja đGreat my friend! đ€đ»
I'm impressed by you workđȘ
Thank a lot my friend đ
+ 8
use a recursive function that will call itself 1000 times, and make the function print your name
+ 5
Hi Danijel IvanoviÄ!
Technically, you are using loop, because method replace() contains it (actually, it has 2 while loops). I was impressed by your solution so I had had to check how it works.đ§đ
Still, looks awesome! đ Beautiful idea (no surprise, physicists are full of them) !đĄđ
https://code.sololearn.com/c8sfev9h1hP9/?ref=app
+ 2
int n =1000;
while(n>0){
system.out.println("name");
n--;
}
0
TurtleShell i completely agree, yours deserves best answer more than mine
0
o satellite i don't know why, but this isn't the first time i've seen such a question
0
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);
}
}
- 1
hinanawi answer is good but I personally think mineâs is better