fork download
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. void main()
  4. {
  5. int n=0;
  6. int i,s,j,k, space,rows;
  7. int A[50];
  8. int r=0;
  9. printf(" Enter the number of rows:");
  10. scanf("%d",&n);
  11. for(i=1;i<=n;i++)
  12. {
  13. if(i%2==0)
  14. {
  15. A[r]=i*((2*i)-1);
  16. ++r;
  17. }
  18. }
  19. for(j=1; j<=n; ++j, k=0)
  20. {
  21. for(space=1; space<=n-j; ++n)
  22. {
  23. printf(" ");
  24. }
  25.  
  26. while(k != 2*j-1)
  27. {
  28. printf(A[r]);
  29. ++r;
  30. ++k;
  31. }
  32.  
  33. printf("\n");
  34. }
  35.  
  36. }
Success #stdin #stdout 0s 9432KB
stdin
Standard input is empty
stdout
 Enter the number of rows: