From 14c58d0cc4bceaee82b838bf10ee7c7aabc65d5e Mon Sep 17 00:00:00 2001 From: Oleksii Aleshchenko Date: Thu, 16 Mar 2023 15:58:44 +0200 Subject: [PATCH] add lab2 --- src/Lab2.java | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/Lab2.java diff --git a/src/Lab2.java b/src/Lab2.java new file mode 100644 index 0000000..473907c --- /dev/null +++ b/src/Lab2.java @@ -0,0 +1,26 @@ +public class Lab2 { + public static void main(String[] args) { + int[] array = {1, 2, 3}; + /*for (int i = 0; i < array.length; i++) { + if (i % 2 == 0) { + System.out.println("!" + array[i]); + } else { + System.out.println("?" + array[i]); + } + }*/ + + for (int i = 0; i < array.length; i+=2) { + System.out.println("!" + array[i]); + } + + for (int i = 1; i < array.length; i+=2) { + System.out.println("?" + array[i]); + } + +// зубчасті матриці + int[][] matrix = { + {1, 2}, + {3} + }; + } +}