fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int n, col, row, val;
  5. printf("Provide value of N: ");
  6. scanf("%d", &n);
  7. for (row = 0; row < n; row++) {
  8. val = 0;
  9. for (col = 0; col <= row; col++) {
  10. val += 2;
  11. printf("%d ", val);
  12. }
  13. for (col = 0; col < row; col++) {
  14. val -= 2;
  15. printf("%d ", val);
  16. }
  17. printf("\n");
  18. }
  19. return 0;
  20. }
Success #stdin #stdout 0s 5440KB
stdin
5
stdout
Provide value of N: 2 
2 4 2 
2 4 6 4 2 
2 4 6 8 6 4 2 
2 4 6 8 10 8 6 4 2