Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void printSpace(int x)
- {
- int i;
- for(i = 0; i < x; i++)
- printf(" ");
- }
- int findn(long double num)
- {
- if ( num < 10 )
- return 1;
- if ( num < 100 )
- return 2;
- if ( num < 1000 )
- return 3;
- if ( num < 10000 )
- return 4;
- if ( num < 100000 )
- return 5;
- if ( num < 1000000 )
- return 6;
- if ( num < 10000000 )
- return 7;
- if ( num < 100000000 )
- return 8;
- if ( num < 1000000000 )
- return 9;
- if ( num < 10000000000 )
- return 10;
- if ( num < 100000000000 )
- return 11;
- if ( num < 1000000000000 )
- return 12;
- if ( num < 10000000000000 )
- return 13;
- if ( num < 100000000000000 )
- return 14;
- if ( num < 1000000000000000 )
- return 15;
- }
- int main(void)
- {
- int n, i, l, c;
- long double mat[20][20];
- long double mat2[20][20];
- long double col[20];
- scanf("%d", &n);
- for(i = 0; i < n; i++)
- {
- int k;
- scanf("%d", &k);
- /*for(l = 0; l < k; l++)
- col[l] = -1;*/
- long double a;
- for(l = 0; l < k; l++)
- for(c = 0; c < k; c++)
- {
- scanf("%llf", &a);
- mat[l][c] = a*a;
- a = findn(mat[l][c]);
- mat2[l][c] = a;
- if(a > col[c])
- col[c] = a;
- }
- printf("Quadrado da matriz #%d:\n", i+4);
- for(l = 0; l < k; l++)
- {
- for(c = 0; c < k; c++)
- {
- printSpace(col[c]-mat2[l][c]);
- if(c != 0)
- printf(" %.llf", mat[l][c]);
- else
- printf("%.llf", mat[l][c]);
- }
- printf("\n");
- }
- printf("\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement