diff options
author | Anton Luka Šijanec <anton@sijanec.eu> | 2023-10-19 13:07:47 +0200 |
---|---|---|
committer | Anton Luka Šijanec <anton@sijanec.eu> | 2023-10-19 13:07:47 +0200 |
commit | 8cebce442f6fe64aa09e4e74837a8e48b8215540 (patch) | |
tree | 6e6c8711eaa27fa85a141c91dd0e995e19db0e72 /šola/p1/vaje/2023-10-19 | |
parent | studisfri (diff) | |
download | r-8cebce442f6fe64aa09e4e74837a8e48b8215540.tar r-8cebce442f6fe64aa09e4e74837a8e48b8215540.tar.gz r-8cebce442f6fe64aa09e4e74837a8e48b8215540.tar.bz2 r-8cebce442f6fe64aa09e4e74837a8e48b8215540.tar.lz r-8cebce442f6fe64aa09e4e74837a8e48b8215540.tar.xz r-8cebce442f6fe64aa09e4e74837a8e48b8215540.tar.zst r-8cebce442f6fe64aa09e4e74837a8e48b8215540.zip |
Diffstat (limited to 'šola/p1/vaje/2023-10-19')
-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; + } + } +} |