fork download
  1. #include <iostream>
  2. using namespace std;
  3. int main(){
  4. // int n;
  5. // int row, col;
  6. // cin >> n;
  7. // if(n == 1){
  8. // cout << "Increase the Value" << endl;
  9. // }
  10.  
  11. // if(n < 0){
  12. // cout << "Increase the Value" << endl;
  13. // }
  14.  
  15. // else if(n%2==0){
  16. // cout << "Even Numbers are not allowed" << endl;
  17. // return false;
  18. // }
  19.  
  20.  
  21. // for(int i=1; i<=n+2; i++){
  22. // for(int j=i; j<=i; j++){
  23. // cout << "e";
  24. // }
  25.  
  26. // for(int k=1; k<=n+2; ++k){
  27. // cout << "*";
  28. // }
  29. // cout << endl;
  30. // }
  31.  
  32. // return 0;
  33. int rows = 5;
  34. int columns = 5;
  35. for (int i = 0; i < rows; ++i) {
  36. for (int j = 0; j < columns; ++j) {
  37. if (i == 0 || j == 0 || (i == rows / 2 && j <= columns / 2)) {
  38. cout << "*";
  39. } else {
  40. cout << " ";
  41. }
  42. }
  43. cout<< endl;
  44. }
  45. }
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
Success #stdin #stdout 0.01s 5308KB
stdin
5
5
stdout
*****
*    
***  
*    
*