How to print pattern like this

Total Post:110

Points:776
 1096  View(s)
Ratings:
Rate this:
Hi,

I want to create following pattern in c++

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

Thanks in advance. 
  1. Post:604

    Points:4228
    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