fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. ios_base::sync_with_stdio(false);
  7. cin.tie(NULL);
  8.  
  9. int n;
  10. if (cin >> n) {
  11. for (int i = 1; i <= n; ++i) {
  12. for (int j = 1; j <= n; ++j) {
  13. if (j == 1 || j == n || i == j) {
  14. cout << '*';
  15. } else {
  16. cout << ' ';
  17. }
  18. }
  19. cout << "\n";
  20. }
  21. }
  22.  
  23. return 0;
  24. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
Standard output is empty