Advertisement
erfanul007

Timus 1319

Nov 9th, 2018
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int a[110][110],n,i,j,k,l,c=0;
  5. scanf("%d",&n);
  6. k=1;
  7. l=n;
  8. while(k<=n){
  9. i=k;
  10. j=l;
  11. while(i<=n && j<=n){
  12. c++;
  13. a[i][j]=c;
  14. i++;
  15. j++;
  16. }
  17. if(l>1)
  18. l--;
  19. else
  20. k++;
  21. }
  22. for(i=1;i<=n;i++){
  23. for(j=1;j<=n;j++){
  24. printf("%d",a[i][j]);
  25. if(j!=n)
  26. printf(" ");
  27. }
  28. printf("\n");
  29. }
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement