1232964
14.12.2022 00:22

Исходное данное — трёхзначное число . Выполни для =146 следующий алгоритм

Нажмите на рекламу ниже и сразу увидите ответ
Популярные вопросы:
Ответ:
Dia3008
08.11.2022 07:19

1)

using System;

using System.Collections.Generic;

using System.Collections.Specialized;

namespace ConsoleApp3

{

   class Program

   {

       static void Main(string[] args)

       {

           int num = Convert.ToInt32(Console.ReadLine());

           Console.WriteLine(num % 2 == 0 ? "Чётное" : "Нечётное");

           Console.WriteLine(num / 10 + num % 10);

       }

   }

}

2)

using System;

using System.Collections.Generic;

using System.Collections.Specialized;

namespace ConsoleApp3

{

   class Program

   {

       static void Main(string[] args)

       {

           double[] seconds = new double[8];

           string[] athletes = new string[8];

           double sum = 0;

           double maxN = 0;

           int max = 0;

           for (int i = 0; i < 8; i++)

           {

               Console.WriteLine($"Введите фамилию {i + 1}-го участника и его результат: ");

               athletes[i] = Console.ReadLine();

               seconds[i] = Convert.ToDouble(Console.ReadLine());

               sum += seconds[i];

               if (seconds[i] > maxN)

               {

                   maxN = seconds[i];

                   max = i;

               }

           }

           Console.WriteLine($"\n\nСредний результат участников - {sum / 8}");

           Console.WriteLine($"Лучший результат у участника с фамилией {athletes[max]} - {maxN}");

       }

   }

}

0,0(0 оценок)
Ответ:
По5643
06.02.2020 18:46
Package main;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
     public static BufferedReader READER = new BufferedReader(new InputStreamReader(System.in));
    public static void main(String[] args) throws IOException {
        int N = Integer.parseInt(READER.readLine());
        int[] array = new int[N];
        for(int i = 0; i < array.length; ++i)
            array[i] = Integer.parseInt(READER.readLine());
        System.out.println("Negative: " + Main.function(array));
    }
     public static boolean function(int[] array) {
        for(int number : array)
            if(number >= 0) return false;
        return true;
     }
}
0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota Оформи подписку
logo
Начни делиться знаниями
Вход Регистрация
Что ты хочешь узнать?
Спроси ai-бота