5.close the j for loop and print a new line under the i loop
6.save and run
THE SOURCE CODE
import java.util.Scanner; class E { public static void main(String[] args)
{ Scanner s=new Scanner(System.in); int n,i,j;//n is for the number which will user input and i ,j is for loop System.out.println("enter the number"); n=s.nextInt(); for (i=0;i<n ;i++ ) { for(j=0;j<n;j++) { if(i%3==0||j==0) { System.out.print("*"); } else { System.out.print(" "); } } System.out.println(); }
Comments
Post a Comment
if you like it or have any doubts please let me know