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"); } } }
2 Answers
+ 2
Remove the line with package hi;.
+ 1
b = a1; b <= a1 and b-- always true. So infinite loop.
May you need to use condition b > 0 ;