fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n, m;
  6. cin >> n >> m;
  7. for (int i = 0; i < n; i++)
  8. {
  9. for (int j = 0; j < m; j++)
  10. {
  11. if ((i == 0) or (j == 0) or (i == n - 1) or (j == m - 1)) cout << "*";
  12. else cout << " ";
  13. }
  14. cout << endl;
  15. }
  16. return 0;
  17. }
Success #stdin #stdout 0s 4516KB
stdin
3 2
stdout
**
**
**