1 solutions

  • 0
    @ 2025-11-5 19:22:41

    C++ :

    #include<iostream>
    
    using namespace std;
    
    void Rectangle(int);
    
    int main()
    {
    	int a;
    	cin >> a;
    	Rectangle(a);
    
    	return 0;
    }
    
    void Rectangle(int a)
    {
    	for(int col=1; col<=a; col++)
    	{
    		cout << '*';
    	}
    	cout << endl;
    	for(int row=2; row<=a-1; row++)
    	{
    		cout << '*';
    		for(int col=2; col<=a-1; col++)
    		{
    			cout << ' ';
    		}
    		cout << '*' << endl;
    	}
    	for(int col=1; col<=a; col++)
    	{
    		cout<< '*';
    	}
    	cout << endl;
    }
    
    • 1

    Information

    ID
    19310
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By