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(odd) to form a new pattern. Help the chef to code this pattern problem.
Program:
#include<bits/stdc++.h>
using namespace std;
int main()
{
//code
int t;
cin>>t;
while(t--){
int n,x=1;
cin>>n;
for(int i=1;i<=n;i++){
for(int j=1;j<=x;j++){
if(j==x)cout<<"*";
else cout<<" ";
}
cout<<endl;
if(i<=n/2)x++;
else x--;
}
}
}