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

1) ввести квадраты натуральных чисел от 1 до заданного,вводимого с клавиатуры(считаем, что введённое число больше 1)
2) вести квадратов натуральных чисел от заданного вводимого с клавиатуры до 35( считаем, что введённое число меньше 35)
Паскаль очень нужно

👇
Ответ:
Mashoo4rik
Mashoo4rik
27.06.2022

1)var a,s:integer;

begin

a:=1;

s:=1;

while sqr(a)<=1 do

begin

s:=s+sqr(a);

a:=a+1;

end;

writeln(s);

end.

2)var a,s:integer;

begin

a:=1;

s:=0;

while sqr(a)<=81 do

begin

s:=s+sqr(a);

a:=a+1;

end;

writeln(s);

end.

4,5(11 оценок)
Открыть все ответы
Ответ:
ShipunovaDaria
ShipunovaDaria
27.06.2022

static void Main(string[] args)

       {

           int N = 0;

           Console.Write("Введите размерность массива: ");

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

           double[,] mas = new double[N, N];

           double sum = 0;

           int viborStroki = 0;

           Console.Write("Введите номер строки: ");

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

           Random rnd = new Random();

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

           {

               for(int j = 0; j<N; j++)

               {

                   mas[i, j] = rnd.Next(0, 10);

               }

           }

           for (int i = viborStroki - 1; i < viborStroki; i++)

           {

               for(int j = 0; j < N; j++)

               {

                   sum += Math.Pow(mas[i, j], 2);

               }

           }

           Console.WriteLine();

           Console.Write("Массив: ");

           Console.WriteLine();

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

           {

               for (int j = 0; j < N; j++)

               {

                   Console.Write(String.Format("{0,3}", mas[i, j]));

               }

               Console.WriteLine();

           }

           Console.Write("Сумма квадратов элементов {0}-й строки = ", viborStroki);

           Console.Write("{0}", sum);

           Console.ReadKey();

       }

Объяснение:

Вводим размерность массива, вводим номер строки, программа считает сумму квадратов элементов введённой строки.

4,4(59 оценок)
Ответ:
Mihailkim2018
Mihailkim2018
27.06.2022

Код:

#include <iostream>

#include <string>

using namespace std;

void printArray(int** arr, size_t X, size_t Y) {

   for (size_t i = 0; i < X; ++i) {

       for (size_t j = 0; j < Y; ++j) {

           cout << arr[i][j] << " ";

       }

       cout << endl;

   }

}

int main() {

   size_t X, Y;

   cout << "Number of rows in the array: ";

   cin >> X;

   cout << "Elements in each row of the array: ";

   cin >> Y;

   int** arr = new int* [X];

   for (size_t i = 0; i < X; ++i) {

       arr[i] = new int[Y];

       cout << "#" << i + 1 << ": ";

       for (size_t j = 0; j < Y; ++j)

           cin >> arr[i][j];

   }

   size_t index;

   cout << "index to check the row for non-decreasing ordering: ";

   cin >> index;

   --index; // numbering from 1

   bool flag = 1;

   for (int i = 0; i < Y - 1; ++i) {

       if (!(arr[index][i] <= arr[index][i + 1])) {

           cout << "No, " << i + 1 << (i + 1 == 1 ? "st" : (i + 1 == 2 ? "nd" : (i + 1 == 3) ? "rd" : "th")) << " element (" << arr[index][i] << ") violates the non-decreasing ordering (" << arr[index][i] << " > " << arr[index][i + 1] << ").\n";

           flag = 0;

           break;

       }

   }

   if (flag)

       cout << "Yes, the specified row is ordered in non-decreasing order.\n";

   flag = 1;

   index = 1;

   cout << "index to check the column for non-increasing ordering: ";

   cin >> index;

   --index;

   flag = 1;

   for (int i = 0; i < X - 1; ++i) {

       if (!(arr[i][index] >= arr[i + 1][index])) {

           cout << "No, " << i + 1 << (i + 1 == 1 ? "st" : (i + 1 == 2 ? "nd" : (i + 1 == 3) ? "rd" : "th")) << " element (" << arr[i][index] << ") violates the non-increasing ordering (" << arr[i][index] << " < " << arr[i][index + 1] << ").\n";

           flag = 0;

           break;

       }

   }

   if (flag)

       cout << "Yes, the specified row is ordered in non-increasing order.\n";

}


Нужна с задачей! Буду рад за ! Задачу надо решить с С++. 12.141. Дан двумерный массив. Составить про
Нужна с задачей! Буду рад за ! Задачу надо решить с С++. 12.141. Дан двумерный массив. Составить про
Нужна с задачей! Буду рад за ! Задачу надо решить с С++. 12.141. Дан двумерный массив. Составить про
4,4(57 оценок)
Новые ответы от MOGZ: Информатика
logo
Вход Регистрация
Что ты хочешь узнать?
Спроси Mozg
Открыть лучший ответ