#include<iostream.h>
void main()
{
int l,w,i,j;
cout<<" Enter the length : ";
cin>>l;
cout<<" Enter the width : ";
cin>>w;
cout<<endl;
for(i=1;i<=w;i++)
{
for(j=1;j<=l;j++)
{
if(i==1||i==w||j==1||j==l)
cout<<"*";
else
cout<<" ";
}
cout<<endl;
}
}
Output:
Enter the length : 13
Enter the width : 7
*************
* *
* *
* *
* *
* *
*************
Press any key to continue |