0

After run of this syntax my console didn't work well.idont know wether it is hang or working it's scroll bar is laydown

package hi; import java.util.Scanner; public class hello { public static void main(String[]a) { System.out.print("enter your number"); Scanner s=new Scanner(System.in); int a1=s.nextInt(); for(int b=a1;b<=a1;b--) { for(int c=0;c<b;c++) { System.out.print("*"); }System.out.print("\n"); } } }

1st Sep 2022, 2:17 PM
Mu_G Rahiman
Mu_G Rahiman - avatar
2 ответов
+ 2
Remove the line with package hi;.
1st Sep 2022, 2:23 PM
JaScript
JaScript - avatar
+ 1
b = a1; b <= a1 and b-- always true. So infinite loop. May you need to use condition b > 0 ;
1st Sep 2022, 3:41 PM
Jayakrishna 🇮🇳