Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int a[110][110],n,i,j,k,l,c=0;
- scanf("%d",&n);
- k=1;
- l=n;
- while(k<=n){
- i=k;
- j=l;
- while(i<=n && j<=n){
- c++;
- a[i][j]=c;
- i++;
- j++;
- }
- if(l>1)
- l--;
- else
- k++;
- }
- for(i=1;i<=n;i++){
- for(j=1;j<=n;j++){
- printf("%d",a[i][j]);
- if(j!=n)
- printf(" ");
- }
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement