0
how to print? 1 22 333 need help..
need help
3 Réponses
+ 5
public class Program {
public static void main(String[] args) {
num();
System.out.println();
}
public static void num() {
for(int i=1; i<=3; i++)
{
for(int j=1; j<=i; j++)
{
System.out.print(i);
}
System.out.println();
}
}
}
+ 3
Another simple way in Java 8.
for(int i = 1; i <=3; i++){
System.out.println(String.join("", Collections.nCopies(i, String.valueOf(i))));
}
0
oke thank you..