fork download
  1. #include <stdio.h>
  2. int main()
  3. {
  4. int i, j, N;
  5. int count;
  6. //printf("Enter N: ");
  7. scanf("%d", &N);
  8. count = N * 2 - 1;
  9. for(i=1; i<=count; i++)
  10. {
  11. for(j=1; j<=count; j++)
  12. {
  13. if(j==i || (j==count - i + 1))
  14. {
  15. printf("*");
  16. }
  17. else
  18. {
  19. printf(" ");
  20. }
  21. }
  22. printf("\n");
  23. }
  24. return 0;
  25. }
  26.  
Success #stdin #stdout 0s 9432KB
stdin
2
stdout
* *
 * 
* *