title: how to print char in multiple times in c++
body: <p>2*</p>
  
  <p>4**</p>
  
  <p>6***</p>
  
  <p>need to output above pattern
  the code given below I have tried</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include&lt;string&gt;
  
  using namespace std;
  
  int main (){
  string star = "*";
  int a=2;
  while(a&lt;=6){
      cout&lt;&lt;a&lt;&lt;star*(a/2)&lt;&lt;endl;
      a+=2;
  }
  return 0;
  }
  </code></pre>