DEV Community

Vasanth S
Vasanth S

Posted on

1

Practice Program (Java)

In java today practiced the program of curly braces pattern program

output :
{}
{} {{}}
{} {{}} {{{}}}
{} {{}} {{{}}} {{{{}}}}

public class braces_pattern {
public static void main(String[] args) {
String a="{";
String b="}";
int A=4;
for (int i=1;i<A;i++){
for (int j=1;j<i+1;j++){
for (int k=j;k<=j;k++){
System.out.print(a);
}
for(int k=j;k<=j;k++){
System.out.print(b);
}
}
System.out.println();
}
}
}

java

leetcode

patterns

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay