• ПОЖАЛУЙСТА, ПОМОГИТЕ РЕШАЕТСЯ МОЯ СУДЬБА!:(

    Дан двумерный массив А[n,m] определить сумму кубов всех элементов массива

Ответы 2

  • Короче примерно набросал#include <stdio.h>#include <conio.h>#include <time.h>#include <stdlib.h>#include <math.h>#define N 5#define M 10int main(){ int a[N][M],i,j,Sum=0; srand((unsigned)time(NULL));for (i=0;i<N;i++){    for(j=0;j<M;j++){       a[i][j]=rand()%10+1;  } }; for (i=0;i<N;i++){   for(j=0;j<M;j++){     Sum=pow(a[i][j],3)+Sum;  } }; printf("%d",Sum); getch ();return 0; }
  • const  nn=30;  mm=30;var  m,n,i,j:integer;  s:longint;  a:array[1..mm,1..nn] of integer;begin  Randomize;  Read(m,n);  s:=0;  for i:=1 to m do begin    for j:=1 to n do begin      a[i,j]:=Random(101)-50;      Write(a[i,j]:4);      s:=a[i,j]*Sqr(a[i,j])      end;    Writeln    end;  Writeln('Сумма кубов равна ',s)  end.Пример4 5  21 -47 -14 -24 -40  34 -49  45 -21 -49 -34 -21  25  41 -46 -44  49 -10   2  14Сумма кубов равна 2744
  • Добавить свой ответ

Войти через Google

или

Забыли пароль?

У меня нет аккаунта, я хочу Зарегистрироваться

How much to ban the user?
1 hour 1 day 100 years