Написать программу для решения на языке basic:
найти произведение всех элементов массива с(15).

Нажмите на рекламу ниже и сразу увидите ответ
Популярные вопросы:
Ответ:
smiley505
13.04.2020 19:00
Const 
    n = 3;
    k = 3;
var
  i,j,s1,s2:integer;
  a:array[1..n,1..k] of integer;
begin
  s1:=0;
  s2:=0;
for i:=1 to n do
    for j:=1 to k do
    begin
     Writeln('Введите a[',i,',',j,']:');
     readln(a[i,j]);
     if (a[i,j]>0) and (i<>j) then s1:=s1+a[i,j];
     if (a[i,j]<0) and (i<>j) then s2:=s2+a[i,j];
    end;
  if s1>s2 then
   for j:=1 to k do
    begin
      a[1,j]:=s1;
      a[n,j]:=s1;
    end;
  if s2>=s1 then
    for i:=1 to n do
    begin
     a[i,1]:=s2;
     a[i,k]:=s2;
    end;
 writeln('Полученный массив:');
  for i:=1 to n do
   begin
     for j:=1 to k do
   write('a[':4,i,',',j,']=',a[i,j]);
   writeln;
   end;
end.
0,0(0 оценок)
Ответ:
Aleksandra987654321
11.06.2020 17:01
#include <iostream.h>
#include <math.h>
int main()
{   
int a, b, c;   
long long d;       
cout << "Vvedite a: ";    cin >> a;   
cout << "\nVvedite b: ";    cin >> b; 
cout << "\nVvedite c: ";    cin >> c;    
d = b * b - 4  *a * c;     
if (d > 0) cout << "x1 = " << (-b + sqrt(d))/(2*a) << "\n" << "x2 = " << (-b - sqrt(d))/(2*a) << endl;
else if (d == 0) cout << "x = " << -1.*b/(2*a) << endl;
else if (d < 0) cout << "Korney net" << endl;
system("pause");
return 0;
}
0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota Оформи подписку
logo
Начни делиться знаниями
Вход Регистрация
Что ты хочешь узнать?
Спроси ai-бота