Advertisement
irapilguy

Untitled

Jan 23rd, 2021
1,209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.16 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n, i;
  8.     cin >> n;
  9.  
  10.     for (int k = 1; k <= n; k++)
  11.     {
  12.  
  13.         for (int j = 1; j <= n; j++)
  14.         {
  15.             if (k == n || k == 1)
  16.             {
  17.                 cout << "*";
  18.             }
  19.             else
  20.             {
  21.                 if (j == 1 || j == n)
  22.                 {
  23.                     cout << "*";
  24.                 }
  25.                 else cout << " ";
  26.             }
  27.  
  28.  
  29.         }
  30.         cout << "\n";
  31.     }
  32. }
  33.  
  34.  
  35. //for (int i = 0; i <= n; i++)
  36. //{
  37. //    cout << "*";
  38.  
  39.  
  40. //  int n, i;
  41. //  cin >> n;
  42. //  for (int k = 0; k <= n; k++)
  43. //  {
  44. //      cout << "*";
  45. //  }  
  46. //  cout << "\n";
  47. //      /*if (k = n || k == 1)
  48. //      {
  49. //cout */
  50. //          for (i = 0; i < n - 2; i++)
  51. //          {
  52. //              for (int j = 0; i <= n; j++)
  53. //              {
  54. //                  if (j == n || j == 0)
  55. //                  {
  56. //                      cout << "*";
  57. //                  }
  58. //                  else
  59. //                  {
  60. //                      cout << " ";
  61. //                  }
  62. //                  cout << "\n";
  63. //              }
  64. //              for (int j = 0; i <= n; j++)
  65. //              {
  66. //                  cout << "*";
  67. //              }
  68. //
  69. //          }
  70. //     
  71. //      /*else
  72. //      {
  73. //          cout << "*";
  74. //      }
  75. //      cout << "\n";
  76. //      */
  77. // 
  78. //      return 0;
  79. //}
  80.  
  81.  
  82.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement