Pattern Series | Interview Code

#include<iostream>

using namespace std;

int main()
{
    int no;
    cin>>no;
    for(auto i=0; i<no; i++)
    {
        for(auto j=i;j<no;j++)
        {
            cout<<"*";
        }
        for(auto j=0;j<i;j++)
        {
            cout<<' ';
        }
        for(auto j=0;j<i;j++)
        {
            cout<<' ';
        }
        for(auto j=i;j<no;j++)
        {
            cout<<"*";
        }
        cout<<"\n";
    }
    return 0;
}
Output will appear here

Leave a comment