Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<math.h>
- int main()
- {
- int n,i,j,x,k;
- while(1)
- {
- scanf("%d",&n);
- if(n==0)
- break;
- else
- {
- for(i=0;i<n;i++)
- {
- for(j=0,k=i;j<n;j++,k++)
- {
- x=pow(2,k);
- if(n==1||n==2)
- printf("%2d",x);
- else if(n==3)
- printf("%3d",x);
- else if(n==4)
- printf("%4d",x);
- else if(n==5)
- printf("%5d",x);
- else if(n==6)
- printf("%6d",x);
- else if(n==7)
- printf("%7d",x);
- else if(n==8)
- printf("%8d",x);
- else if(n==9)
- printf("%9d",x);
- else if(n==10)
- printf("%10d",x);
- else if(n==11)
- printf("%11d",x);
- else if(n==12)
- printf("%12d",x);
- else if(n==13)
- printf("%13d",x);
- else if(n==14)
- printf("%14d",x);
- else if(n==15)
- printf("%15d",x);
- }
- printf("\n");
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement