This commit is contained in:
Gašper Dobrovoljc 2024-03-10 17:56:47 +01:00
parent 063f5feb2d
commit 8e0baa5eb7
No known key found for this signature in database
GPG Key ID: 0E7E037018CFA5A5

22
src/DN02.java Normal file
View File

@ -0,0 +1,22 @@
public class DN02 {
public static void main(String[] args) {
String besedilo = args[0];
int n = (int) Math.ceil(Math.sqrt(besedilo.length()));
int i = 0;
for (int j = 0; j < n; j++) {
for (int k = 0; k < n; k++) {
if (i >= besedilo.length()) {
System.out.print(" . ");
continue;
}
System.out.print(" " + besedilo.charAt(i) + " ");
i++;
}
System.out.println();
}
}
}