Home > DeveloperSection > Forums > How to print pattern like this
Jeet Verma
Jeet Verma

Total Post:110

Points:776
Posted on    June-14-2013 9:50 AM

 Visual C++ Visual C++ 
Ratings:


 1 Reply(s)
 674  View(s)
Rate this:
Hi,

I want to create following pattern in c++

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

Thanks in advance. 


AVADHESH PATEL

Total Post:604

Points:4228
Posted on    June-15-2013 4:49 AM

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;
  }

Don't want to miss updates? Please click the below button!

Follow MindStick