Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- int N, cont = 0;
- while(scanf("%d", &N))
- {
- if(N==0) break;
- int M[N][N];
- for(int i=0; i<N; i++)
- {
- for(int j=0; j<N; j++)
- {
- M[i][j] = 0;
- }
- }
- for(int i=0; i<N; i++)
- {
- for(int j=0; j<N; j++)
- {
- M[i][0]=pow(2,i);
- M[i][j]=M[i][j-1]*2;
- cont++;
- }
- }
- for(int i=0; i<N; i++)
- {
- for(int j=0; j<N; j++)
- {
- if(cont==N-1) printf("%d\n", M[i][j]);
- else printf("%d ", M[i][j]);
- }
- printf("\n");
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement