Answers for "hollow rectangle pattern c++"

C++
0

hollow rectangle pattern c++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int row,col;
	cin>>row>>col;
	for(int i=1;i<=row;i++){
		for(int j=1;j<=col;j++){
			if(i==1||i==row||j==1||j==col){
				cout<<"*";
			}
			else{
				cout<<" ";
			}
		}
		cout<<endl;
	}
}
Posted by: Guest on June-05-2021

Browse Popular Code Answers by Language