Facebook
From Unique Bison, 5 Years ago, written in Plain Text.
This paste is a reply to Untitled from Smelly Duck - view diff
Embed
Download Paste or View Raw
Hits: 309
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int tab[5][5]={{1,2,3,4,5},
  8.                    {2,1,3,4,5},
  9.                    {4,2,1,5,3},
  10.                    {5,2,4,1,3},
  11.                    {3,2,4,5,1}};
  12.     int j,i,suma=0;
  13.     cout << "Przekatna sum!" << endl;
  14.  
  15.     for (i=0;i<5;i++)
  16.     {
  17.         for (j=5;j>0;j--)
  18.         {
  19.             cout <<tab[i][j]<<" ";
  20.             if (i==j) suma=suma+tab[i][j];
  21.         }
  22.  
  23.     cout <<endl;
  24.     }
  25.     cout <<suma;
  26.     return 0;
  27. }
  28.