М
Молодежь
К
Компьютеры-и-электроника
Д
Дом-и-сад
С
Стиль-и-уход-за-собой
П
Праздники-и-традиции
Т
Транспорт
П
Путешествия
С
Семейная-жизнь
Ф
Философия-и-религия
Б
Без категории
М
Мир-работы
Х
Хобби-и-рукоделие
И
Искусство-и-развлечения
В
Взаимоотношения
З
Здоровье
К
Кулинария-и-гостеприимство
Ф
Финансы-и-бизнес
П
Питомцы-и-животные
О
Образование
О
Образование-и-коммуникации
nik22041
nik22041
14.12.2021 14:32 •  Информатика

Задача 11 Составить программу которая будет расставлять по в порядке возрастания три введённых числа и находить сумму их квадратов. Пример: вводят 8, 4, 6 вывод 4, 6, 8 16+36+64 =116​

👇
Ответ:
XУЙ228228
XУЙ228228
14.12.2021

C#

double a, b, c, s;

           ConsoleKeyInfo keyInfo;

           do

           {

               Console.Write("Введите первое число: ");

               a = Convert.ToInt32(Console.ReadLine());

               Console.Write("Введите второе число: ");

               b = Convert.ToInt32(Console.ReadLine());

               Console.Write("Введите третее число: ");

               c = Convert.ToInt32(Console.ReadLine());

               Console.WriteLine("");

               if (a < b && a < c)

               {

                   Console.WriteLine(a);

                   Console.WriteLine(Math.Min(b, c));

                   Console.WriteLine(Math.Max(b, c));

               }

               if (b < a && b < c)

               {

                   Console.WriteLine(b);

                   Console.WriteLine(Math.Min(a, c));

                   Console.WriteLine(Math.Max(a, c));

               }

               if (c < b && c < a)

               {

                   Console.WriteLine(c);

                   Console.WriteLine(Math.Min(a, b));

                   Console.WriteLine(Math.Max(a, b));

               }

               Console.WriteLine("");

               a = Math.Pow(a, 2);

               b = Math.Pow(b, 2);

               c = Math.Pow(c, 2);

               if (a < b && a < c)

               {                    

                   Console.WriteLine(a);

                   Console.WriteLine(Math.Min(b, c));

                   Console.WriteLine(Math.Max(b, c));

               }                  

               

               if (b < a && b < c)

               {            

                   Console.Write(b);

                   Console.WriteLine(Math.Min(a, c));

                   Console.WriteLine(Math.Max(a, c));

               }

               if (c < b && c < a)

               {                    

                   Console.Write(c);

                   Console.WriteLine(Math.Min(a, b));

                   Console.WriteLine(Math.Max(a, b));

                   

               }

               Console.WriteLine("");

               s = a + b + c;

               Console.WriteLine("" + s + "\n");

               Console.WriteLine("Если хотите повторить программу нажмите F");

               Console.WriteLine("Если хотите завершить программу нажмите любую другую кнопку\n");

               keyInfo = Console.ReadKey(true);

           }

           while (keyInfo.Key == ConsoleKey.F);

4,8(73 оценок)
Ответ:
метал3
метал3
14.12.2021

Python:

def sorting(*args):

   print(*sorted(args))

   sum = 0

   for i in args:

       sum += i * i

   print(sum)

sorting(8, 4, 6)

Объяснение:

4,5(12 оценок)
Открыть все ответы
Ответ:
Ivanych086
Ivanych086
14.12.2021
Const
  n1=15;
  n2=10;
  n3=12;
type
  V=array[1..15] of string;
procedure M_in(s:string; var a:V; n:integer);
{ ввод данных в массив }
var i:integer;
begin
  Writeln('Вводите по одному ',n,' элементов массива ',s);
  for i:=1 to n do Readln(a[i])
end; 

procedure M_out(var a:V; n:integer; c:char);
{ выводит элементы, начинающиеся с указанного символа }
var i:integer;
begin
  Writeln('*** Слова на букву ',c,' ***');
  for i:=1 to n do
    if a[i][1]=c then Writeln(a[i]);
  Writeln
end; 

var
  s1,s2,s3:V;
begin
  M_in('S1',s1,n1);
  M_in('S2',s2,n2);
  M_in('S3',s3,n3);
  M_out(s1,n1,'В');
  M_out(s2,n2,'Ц');
  M_out(s3,n3,'А');
end.
4,7(74 оценок)
Ответ:
Okladakey
Okladakey
14.12.2021
Незнаю верно ли я все понял, но как вариант можно сделать так
//Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506 for x64

#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <iterator>
#include <algorithm>

bool DigitFirst(const std::string& rhs, const std::string& lhs)
{
    if (isdigit(rhs[0]) || isdigit(lhs[0]))
        return rhs < lhs;
}

bool LetterFirst(const std::string& rhs, const std::string& lhs)
{
    if (isalpha(rhs[0]) || isalpha(lhs[0]))
        return rhs < lhs;
}

const std::string TrueSort(std::string str, bool(*comparator)(const std::string&
rhs, const std::string& lhs))
{
    std::stringstream ss(str);
    std::vector<std::string> vstr(std::istream_iterator<std::string>(ss), {});
    std::sort(vstr.begin(), vstr.end(), comparator);
    ss.clear();
    std::copy(vstr.begin(), vstr.end(), std::ostream_iterator<std::string>(ss, " "));
    return ss.str();
}

int main()
{
    std::string first  = "position total 12345 2jz asd512fgh";
    std::string second = "year 10010 2018r r98k hello";
    std::cout << TrueSort(first,  DigitFirst ) << std::endl;
    std::cout << TrueSort(second, LetterFirst);
}
4,8(43 оценок)
Это интересно:
Новые ответы от MOGZ: Информатика
logo
Вход Регистрация
Что ты хочешь узнать?
Спроси Mozg
Открыть лучший ответ