0

One of the edge case

So in the pattern when you do it for n=1, it prints 2 stars when it should just print 1 star. So any solutions to solve that?! https://code.sololearn.com/cGmERVak3oZ0/?ref=app

9th Jun 2020, 9:32 AM
Kashish
Kashish - avatar
2 Answers
+ 4
Hi Kashish at line 25 add a condition so to check if n > 1 then print for(int i=1;i<=n&&n>1;i++){ System.out.print("* "); }
9th Jun 2020, 9:40 AM
RKK
RKK - avatar
+ 1
Thank you for helping
9th Jun 2020, 9:49 AM
Kashish
Kashish - avatar