From 8cebce442f6fe64aa09e4e74837a8e48b8215540 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Thu, 19 Oct 2023 13:07:47 +0200 Subject: vaje --- "\305\241ola/p1/vaje/2023-10-19/Kvadrati.java" | 10 ++++++++++ "\305\241ola/p1/vaje/2023-10-19/Modulo.java" | 9 +++++++++ "\305\241ola/p1/vaje/2023-10-19/Roman.java" | 15 +++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 "\305\241ola/p1/vaje/2023-10-19/Kvadrati.java" create mode 100644 "\305\241ola/p1/vaje/2023-10-19/Modulo.java" create mode 100644 "\305\241ola/p1/vaje/2023-10-19/Roman.java" diff --git "a/\305\241ola/p1/vaje/2023-10-19/Kvadrati.java" "b/\305\241ola/p1/vaje/2023-10-19/Kvadrati.java" new file mode 100644 index 0000000..53d3177 --- /dev/null +++ "b/\305\241ola/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/\305\241ola/p1/vaje/2023-10-19/Modulo.java" "b/\305\241ola/p1/vaje/2023-10-19/Modulo.java" new file mode 100644 index 0000000..85c92cd --- /dev/null +++ "b/\305\241ola/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/\305\241ola/p1/vaje/2023-10-19/Roman.java" "b/\305\241ola/p1/vaje/2023-10-19/Roman.java" new file mode 100644 index 0000000..d44f633 --- /dev/null +++ "b/\305\241ola/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; + } + } +} -- cgit v1.2.3