Print "Greater Than" (>) Pattern

09:26 0 Comments A+ a-

Problem:
                    Print the Greater Than sign on console.
Solution:
# include <iostream>
# include <iomanip>
using namespace std;
int main()
{
int n,l;
cin>>n;
l=n/2;
int a=1;
for(int i=0;i<l;i++)
{
cout<<setw(a)<<"*";
cout<<endl;
a++;
}
cout<<setw((n/2)+1)<<"*"<<endl;
int b=n/2;
for(int i=0;i<l;i++)
{
cout<<setw(b)<<"*";
cout<<endl;
b--;
}



return 0;

}