From e4f90035f0143eb86ba2001efa2893a16c43b604 Mon Sep 17 00:00:00 2001 From: MAKSYM BILYK <125198066+Namelesa@users.noreply.github.com> Date: Sun, 12 Feb 2023 15:52:56 +0200 Subject: [PATCH] Create Bilyk_Maxim_IO-22 --- Bilyk_Maxim_IO-22 | 84 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 Bilyk_Maxim_IO-22 diff --git a/Bilyk_Maxim_IO-22 b/Bilyk_Maxim_IO-22 new file mode 100644 index 0000000..79fa9e8 --- /dev/null +++ b/Bilyk_Maxim_IO-22 @@ -0,0 +1,84 @@ +import java.util.Scanner; +public class Main { + public static void main(String[] args) + { + float s = 0f; + double i = 0; + double j = 0; + double sum_d; + double sum_u; + Scanner in = new Scanner(System.in); + System.out.print("Input a number your record book: \n"); + int c = in.nextInt(); + int c2 = c % 2; + int c3 = c % 3; + int c5 = c % 5; + int c7 = c % 7; + + switch (c7){ + case 0: + i = (byte) i; + j = (byte) j; + case 1: + i = (short) i; + j = (short) j; + case 2: + i = (int) i; + j = (int) j; + case 3: + i = (long) i; + j = (long) j; + case 4: + i = (char) i; + j = (char) j; + case 5: + i = (float) i; + j = (float) j; + case 6: + i = i; + j = j; + } + + System.out.print("Input a: "); + int a = in.nextInt(); + System.out.print("Input b: "); + int b = in.nextInt(); + System.out.print("Input n: "); + int n = in.nextInt(); + System.out.print("Input m: "); + int m = in.nextInt(); + + in.close(); + + for(i = a; i <= n; i++) + { + if(c2 == 0) + sum_d = i+c3; + else + sum_d = i -c3; + if(sum_d == 0) + { + System.out.println("Lol"); + break; + } + else { + for (j = b; j <= m; j++) + { + if (c5 == 0) + sum_u = i*j; + else if (c5 == 1) + sum_u = i/j; + else if (c5 == 2) + sum_u = i%j; + else if (c5 == 3) + sum_u = i+j; + else + sum_u = i-j; + + s += (double) sum_u / sum_d ; + } + } + } + System.out.println(s); + } +}