C++ program to print Triangle pattern of asterisks

#include<iostream>
using namespace std;

int main()
{
   int rows;
   cout<<"Enter Number of rows ";
   cin>>rows;

for (int j=0;j<rows;++j)
{
for(int k=rows-j;k>0;--k)
{
cout<<" ";
}
for (int m=0;m<j;++m)
{

{
cout<<"*"<<" ";
}

}
cout<<"   "<<endl<<"   ";
}
return 0;
}

No comments:

Post a Comment