Сформировать и вывести на экран заданный двумерный массив (для заполнения массива использовать формулу) — C++(Си)

10 20 30 40
20 30 40 50
30 40 50 60
40 50 60 70

#include <iostream.h>
#include <iomanip.h>
 
int main(int argc, char *argv[])
{
   const int SIZE = 4;
   int array[SIZE][SIZE] = {0};
 
   for (int i = 0; i < SIZE; i++)
   {
      for (int j = 0; j < SIZE; j++)
      {
         array[i][j] = (i + 1) * 10 + j * 10;
         cout << setw(4) << array[i][j];
      }
   cout << endl;
   }
   return 0;
}

Leave a Comment