Hollow Rectangle
#include<iostream>
using namespace std;
int main()
{
int num,ret;
cout << "Enter Width : ";
cin >> num;
cout << "Enter Height : ";
cin >> ret;
for (int i = 1; i <= ret; i++)
{
for(int j=1;j<=num;j++)
{
if (i == 1 || i == ret || j == 1 || j == num)
cout << " * ";
else
cout << " ";
}
cout << endl;
}
system("pause");
return 0;
}
Comments
Post a Comment