Computer Science, asked by bearmochi78, 5 months ago

please solve it, fast, no spam please​

Attachments:

Answers

Answered by himanshu2006vps
0

Answer:

import java.util.Scanner;

class Pattern

{

public static void main(String[] args)

{

Scanner sc = new Scanner(System.in);

System.out.println("Enter the numbers of rows : ");

int n = sc.nextInt();

for (int i = 1; i <= n; i++) {

for (int j = 1; j <= n; j++) {

if (i == j) {

System.out.print(i);

} else {

System.out.print("1");

}

}

System.out.println();

}

}

}

Similar questions