public class p1 { public static void main(String[] args) { for(int i=1; i<=5; i++) { for(int j=1; j<=5;j++) { System.out.print("* "); } System.out.println(); } } } OUTPUT * * * * * * * * * * * * * * * * * * * * * * * * *
public class p2 { public static void main(String[] args) { for(int i=1; i<=5; i++) { for(int j=1; j<=5;j++) { System.out.print(i+" "); } System.out.println(); } } } OUTPUT 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5
public class p4 { public static void main(String[] args) { for(int i=1; i<=5; i++) { for(int j=1; j<=5;j++) { System.out.print(j+" "); } System.out.println(); } } } OUTPUT 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5
No comments:
Post a Comment
If you have any doubts, please let me know