fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n;
  6. cin >> n;
  7. for (int i = n; i > 0; i--) {
  8. for (int first = n; i % n == 0 && first > 0;) { //facem primul rand
  9. cout << "*";
  10. first--;
  11. if (first == 0) {
  12. cout << "\n";
  13. }
  14. }
  15. if (i > n - 2) {
  16.  
  17. } else {
  18. for (int copy = n; copy > 0;) {
  19. if (copy == n || copy == 1) {
  20. cout << "*";
  21. } else {
  22. cout << "$";
  23. }
  24. copy--;
  25. }
  26. cout << "\n";
  27. }
  28. for (int last = 1; last == i;) {//ultimul
  29. for (int copy = n; copy > 0;){
  30. cout << "*";
  31. copy--;
  32. }
  33. i = 0;
  34. }
  35. }
  36. return 0;
  37. }
Success #stdin #stdout 0.01s 5280KB
stdin
11














stdout
***********
*$$$$$$$$$*
*$$$$$$$$$*
*$$$$$$$$$*
*$$$$$$$$$*
*$$$$$$$$$*
*$$$$$$$$$*
*$$$$$$$$$*
*$$$$$$$$$*
*$$$$$$$$$*
***********