diff options
-rw-r--r-- | šola/p1/vaje/2023-10-19/Kvadrati.java | 10 | ||||
-rw-r--r-- | šola/p1/vaje/2023-10-19/Modulo.java | 9 | ||||
-rw-r--r-- | šola/p1/vaje/2023-10-19/Roman.java | 15 |
3 files changed, 34 insertions, 0 deletions
diff --git a/šola/p1/vaje/2023-10-19/Kvadrati.java b/šola/p1/vaje/2023-10-19/Kvadrati.java new file mode 100644 index 0000000..53d3177 --- /dev/null +++ b/šola/p1/vaje/2023-10-19/Kvadrati.java @@ -0,0 +1,10 @@ +import java.util.*; +public class Kvadrati { + public static void main (String[] args) { + Scanner sc = new Scanner(System.in); + int a = sc.nextInt(); + int b = sc.nextInt(); + for (int i = a; i <= b; i++) + System.out.println(i*i); + } +} diff --git a/šola/p1/vaje/2023-10-19/Modulo.java b/šola/p1/vaje/2023-10-19/Modulo.java new file mode 100644 index 0000000..85c92cd --- /dev/null +++ b/šola/p1/vaje/2023-10-19/Modulo.java @@ -0,0 +1,9 @@ +import java.util.*; +public class Modulo { + public static void main (String[] args) { + Scanner sc = new Scanner(System.in); + String a = sc.nextLine(); + for (int i = a.length()-1; i >= 0; i--) + System.out.println(a.substring(i, i+1)); + } +} diff --git a/šola/p1/vaje/2023-10-19/Roman.java b/šola/p1/vaje/2023-10-19/Roman.java new file mode 100644 index 0000000..d44f633 --- /dev/null +++ b/šola/p1/vaje/2023-10-19/Roman.java @@ -0,0 +1,15 @@ +import java.util.*; +public class Roman { + public static void main (String[] args) { + Scanner sc = new Scanner(System.in); + int p = sc.nextInt(); + int d = sc.nextInt(); + int z = sc.nextInt(); + int dan = 0; + while (p > 0 && d > 0) { + System.out.println(++dan + ": " + p + " -> " + (p-d > 0 ? p-d : 0)); + p -= d; + d -= z; + } + } +} |