Code:
for (i=1;i<max;i++)
{
   for(j=i;j>0;j--)
      { 
      cout<<i;
      }

cout<<"\n";
}

try similar logic i guess it will work