Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class MyTaskk {
- public static void DoTaskk() {
- Scanner sc = new Scanner(System.in);
- System.out.println("Введите количество чисел: ");
- int N = sc.nextInt();
- int[] aiArray = new int[N];
- int[] biArray = new int[N];
- System.out.println("Введите числа:");
- for (int i = 0; i < N; i++) {
- aiArray[i] = sc.nextInt();
- }
- for (int i = 0; i < N; i++) {
- int ai = aiArray[i];
- if (ai % 2 == 0 && ai % 5 == 0) {
- biArray[i] = ai;
- } else if (ai % 2 == 0) {
- biArray[i] = ai * ai;
- } else if (ai % 5 == 0) {
- biArray[i] = ai * ai * ai;
- } else {
- biArray[i] = 1 / ai;
- }
- }
- System.out.println("Список bi:");
- for (int i = 0; i < N; i++) {
- System.out.println(biArray[i]);
- }
- }
- public void doTask() {
- Scanner sc = new Scanner(System.in);
- System.out.println("Введите количество чисел: ");
- int N = sc.nextInt();
- int[] aiArray = new int[N];
- int[] biArray = new int[N];
- System.out.println("Введите числа:");
- for (int i = 0; i < N; i++) {
- aiArray[i] = sc.nextInt();
- }
- for (int i = 0; i < N; i++) {
- int ai = aiArray[i];
- if (ai % 2 == 0 && ai % 5 == 0) {
- biArray[i] = ai;
- } else if (ai % 2 == 0) {
- biArray[i] = ai * ai;
- } else if (ai % 5 == 0) {
- biArray[i] = ai * ai * ai;
- } else {
- biArray[i] = 1 / ai;
- }
- }
- System.out.println("Список bi:");
- for (int i = 0; i < N; i++) {
- System.out.println(biArray[i]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement