How to print pattern like this

Posted by  Jeet Verma
 1331  View(s)
Ratings:
Rate this:
Hi,

I want to create following pattern in c++

*
**
***
****
*****

Thanks in advance. 
  1. Re: How to print pattern like this

    Hi,


    try this:

    int main()
    {
       int i,j;
       for(i=0;i<5;i++)
       {
          for(j=0;j<=i;j++)
           {
             cout<<"*";
             cout<<" ";
           }
         cout<<"\n";
        }
    return 0;
      }

      Modified On Mar-30-2018 03:54:34 AM

Answer