Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <math.h>
- #include <stdlib.h>
- int main()
- {
- int x;
- int z;
- int n = 0;
- int y;
- int k = 0;
- int k1;
- int tab[1000];
- scanf("%d", &n);
- for (y = 0; y < n; y++){
- for (x = 0; x < n; x++){
- if (y !=0 && y < n) tab[x] = (n-k);
- if (k < y) k++;
- }
- for(z = 0; z < n; z++) {
- if (y == 0) printf("%d ", n);
- if (y > 0 && y < n) printf("%d ", tab[z]);
- }
- for(z = (n-2) ; z >= 0; z--) {
- if (y == 0) printf("%d ", n);
- if (y > 0 && y < n) printf("%d ", tab[z]);
- }
- printf("\n");
- k = 0;
- }
- ///////////////////////IIpolowa zadania////////////////
- for (y = (n-2); y >= 0; y--){
- for (x = 0; x < n; x++){
- if (y !=0) tab[x] = (n-k);
- if (k < y) k++;
- }
- for(z = 0; z < n; z++) {
- if (y == 0) printf("%d ", n);
- if (y > 0 ) printf("%d ", tab[z]);
- }
- for(z = (n-2) ; z >= 0; z--) {
- if (y == 0) printf("%d ", n);
- if (y > 0) printf("%d ", tab[z]);
- }
- printf("\n");
- k = 0;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement