| New file |
| | |
| | | public class DivisorPattern { |
| | | public static void main(String[] args) { |
| | | int limite = Integer.parseInt(args[0]); |
| | | |
| | | for (int i = 1; i <= limite; i++) { |
| | | for (int j = 1; j <= i; j++) { |
| | | if (i % j == 0) { |
| | | System.out.print("* "); |
| | | } else { |
| | | System.out.print(" "); |
| | | } |
| | | } |
| | | System.out.println(); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | public class PowerOfTwo { |
| | | public static void main(String[] args) { |
| | | int limite = Integer.parseInt(args[0]); |
| | | |
| | | int conta = 1; |
| | | for (int i = 1; i <= limite; i++) { |
| | | int potenza = i * i; |
| | | if (potenza <= limite) { |
| | | System.out.println(conta + " " + potenza); |
| | | conta++; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| New file |
| | |
| | | public class TenHello { |
| | | |
| | | public static void main(String[] args) { |
| | | |
| | | System.out.println("Hello, World! " + "1st"); |
| | | System.out.println("Hello, World! " + "2sd"); |
| | | System.out.println("Hello, World! " + "3rd"); |
| | | |
| | | for (int i = 4; i <= 10; i++) { |
| | | System.out.println("Hello, World! " + i + "th"); |
| | | } |
| | | } |
| | | } |