> Write a program to print following pattern:
Solution:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 2 3 4 | |
1 2 3 4 | |
1 2 3 4 | |
1 2 3 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
class pattern | |
{ | |
public static void main(String ar[]) | |
{ | |
Scanner scan = new Scanner(System.in); | |
System.out.println("Enter the limit or number of lines"); | |
int limit = scan.nextInt(); | |
for(int i=1; i<=limit; i++){ | |
for(int j=1; j<=limit; j++){ | |
System.out.print(j+"\t"); | |
} | |
System.out.println(); | |
} | |
} | |
} |
Comments
Post a Comment