Advertisement
Lagx

clase 31/08/17

Aug 31st, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.63 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4.  
  5. int main()
  6. {
  7.     int n,col,i,j,aux;
  8.     unsigned long long fil;
  9.     scanf("%d",&n);
  10.    
  11.     col = n;
  12.     aux = pow(2,n);
  13.     fil = aux;
  14.    
  15.     int matriz[fil][col];
  16.    
  17.     for(i=0;i<fil;i++)
  18.     {
  19.         for(j=0;j<col;j++)
  20.         {
  21.             matriz[i][j]=0;
  22.         }
  23.     }
  24.    
  25.     for(i=0;i<fil;i++)
  26.     {
  27.         for(j=col-1;j>=0;j--)
  28.         {
  29.             if(i && 1)
  30.             {
  31.                 matriz[i][j]=0;
  32.             }
  33.             else
  34.             {
  35.                 matriz[i][j]=1;
  36.             }
  37.         }
  38.         for(j=0;j<col;j++)
  39.         {
  40.             printf("%d",matriz[i][j]);
  41.         }
  42.         printf("\n");
  43.     }
  44.    
  45.     /*for(i=0;i<fil;i++)
  46.     {
  47.         for(j=0;j<col;j++)
  48.         {
  49.             printf("%d",matriz[i][j]);
  50.         }
  51.         printf("\n");
  52.     }*/
  53.    
  54.     return 0;
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement