how to print the below pattern using only one loop?
*
**
***
****
*****
for(int i=1;i<=5;i++)
{
for(int j=1;j<=i;j++)
{
print("*");
}
print("\n");
}
every one know this, but using only on loop how?
it's really an interview question.he asked me that he will ask next question after answering this.
Best logic for printing a specific pattern
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.


VulpesRank #55 · 29.2K reputationPosted May 31, 2013, 9:02 AM EDT
Saroj Manik36 reputationPosted Jun 15, 2015, 11:55 PM EDT