fork download
  1. //Q52. Write a program to print the following pattern:
  2.  
  3. //*
  4.  
  5. //*
  6. //*
  7. //*
  8.  
  9. //*
  10. //*
  11. //*
  12. //*
  13. //*
  14.  
  15. //*
  16. //*
  17. //*
  18.  
  19. //*
  20. #include <stdio.h>
  21.  
  22. int main(void) {
  23. int groups[] = {1, 3, 4, 3, 1};
  24. int m = sizeof(groups) / sizeof(groups[0]);
  25.  
  26. for (int i = 0; i < m; ++i) {
  27. for (int j = 0; j < groups[i]; ++j) {
  28. printf("*\n");
  29. }
  30. if (i != m - 1)
  31. putchar('\n');
  32. }
  33.  
  34. return 0;
  35. }
  36.  
Success #stdin #stdout 0s 5312KB
stdin
Standard input is empty
stdout
*

*
*
*

*
*
*
*

*
*
*

*