Computer Science, asked by Daaniyalkhan12, 8 months ago

If u can please help me solve this .
I will mark u Brainliest!!
Write a program in Java to print the following pattern:
1
$ #
1 $ 1
# 1 1 1
$ 1 # 1 $

Answers

Answered by Anonymous
1

Answer:

import java.util.Scanner;

public class MainClass

{

public static void main(String[] args)

{

Scanner sc = new Scanner(System.in);

//Taking rows value from the user

System.out.println("How many rows you want in this pattern?");

int rows = sc.nextInt();

System.out.println("Here is your pattern....!!!");

for (int i = 1; i <= rows; i++)

{

for (int j = 1; j <= i; j++)

{

System.out.print(j+" ");

}

System.out.println();

}

//Close the resources

sc.close();

}

}

Similar questions