Table of Contents
In this article, we will discuss Floyd’s triangle number pattern using for loop in Java
We can display many types of the rectangle, square shapes, many types of tables, pyramid shapes and Floyd’s triangle shapes using java.
In this post, we are going to how to display triangle number pattern using for loop in Java language
We will use for loop, in java for this purpose
How to print this floyd’s triangle using numaric numbers?
Program 2
Program 3
12345678910
123456789
12345678
1234567
123456
12345
1234
123
12
1
class forcondition1{
public static void main(String args[]){
int y=10;
for(int row=10; row>=1; row--){
for(int coloum=1; coloum<=y; coloum++)
{
System.out.print(coloum);
}
System.out.println();
y=y-1;
}
}
}
class forcondition3{
public static void main(String args[]){
int y=10;
for(int row=10; row>=1; row--){
for(int coloum=10; coloum>=y; coloum--)
{
System.out.print(row);
}
System.out.println();
y=y-1;
}
}
}
public class PrintingFourPatternUsingLoops {
public static void main(String[] args)
{
for (int i = 1; i < 7; i++) {
for (int j = 1; j < i + 1; j++) {
System.out.print(j);
}
System.out.println();
}
System.out.println();
for(int k = 8; k > 1; k--) {
for(int l = 1; l < k - 1; l++){
System.out.print(l);
}
System.out.println();
}
}
}
public class Demo8
{
public static void main(String[] args)
{
for(int i=1;i<=5;i++)
{
for(int j=i;j>=1;j--)
{
System.out.print(j);
}
for (int k=2;k<=i;k++)
{
System.out.print(k);
}
System.out.println();
}
}
}
Multiply two numbers in Java using scanner| 5 different ways In this article, we will…
5 Different ways to Divide two numbers in Java using scanner In this article, we…
Learn 8 Ways to Subtract Two Numbers Using Methods in Java In this article, we…
10 ways to subtract two numbers in Java In this article, we will discuss the…
Java Code Examples – Multiply Two Numbers in 5 Easy Ways In this article, we…
How to Divide two numbers in Java| 5 different ways In this article, we will…
This website uses cookies.