Lool199865
06.11.2022 02:03

Python
Напишите программу, в которой:
Даны два целых числа A и В. Выводятся все нечётные числа от A до B включительно. В этой программе нельзя использовать конструкцию if.

Нажмите на рекламу ниже и сразу увидите ответ
Популярные вопросы:
Ответ:
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 оценок)
Ответ:
Bayana000
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 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota Оформи подписку
logo
Начни делиться знаниями
Вход Регистрация
Что ты хочешь узнать?
Спроси ai-бота