Problem: Contest Page | CodeChef
DIFFICULTY:
EASY.
PROBLEM:
The chef is trying to solve some pattern problems, Chef wants your help to code it. Chef has one number K to form a new pattern. Help the chef to code this pattern problem.
Program:
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t,n;
cin>>t;
while(t--){
cin>>n;
int z=1;
for(int i=0;i<n;i++){
for(int j=2;j>0;j--){
for(int k=n-1;k>i;k--)cout<<" ";
for(int k=0;k<z;k++)cout<<"*";
cout<<"\n";
}
z+=2;
}
}
}