Advertisement
Lisaveta777

Zmeika 3 easy

Dec 31st, 2019
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.51 KB | None | 0 0
  1. #include <stdio.h>
  2. #define SIZE 5
  3.  
  4.  
  5. int main() {
  6.  
  7.  
  8.     int i,j,arr[SIZE][SIZE],zm=0;
  9.  
  10.     for(i=SIZE-1;i>=0;i--)
  11.     {
  12.         if( !(SIZE-i)%2)
  13.         {
  14.             for(j=0;j<SIZE;j++)
  15.                 arr[i][j]=zm++;
  16.         }
  17.         else
  18.         {
  19.             for(j=SIZE-1;j>=0;j--)
  20.                 arr[i][j]=zm++;
  21.         }
  22.     }
  23.  
  24.     for(i=0;i<SIZE;i++)//print array
  25.     {
  26.         for(j=0;j<SIZE;j++)
  27.             printf("%d\t",arr[i][j]);
  28.         printf("\n");
  29.     }
  30.  
  31.      return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement