For ststement

Floyd’s triangle number pattern using for loop in Java

floyd’s triangle number pattern using for loop  in Java

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?

1
12
123
1234
12345
123456
1234567
12345678
123456789
12345678910


Program 2

class patternn{
public static void main(String args[]){
for(int i=1; i<=10; i++)
{
for(int j=1; j<=i; j++){
System.out.print(j);
}
System.out.println();
}
}
}
Wen the above code is executed, it produces the folowing result
Example 1

Program 3

  • How to print inverted floyd’s triangle using numaric numbers?


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;
}


}
}

 

When the above code is compiled and executed, it produces the following result:

 

Output

 

  • How to print floyd’s triangle using numaric numbers?
10
99
888
7777
66666
555555
4444444
33333333
222222222
1111111111
program 4
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;
}
}
}

 

When the above code is compiled and executed, it produces the following result:
Output
this is another inverted Floyd’s triangle using numeric numbers?
  • How to print inverted Floyd’s triangle using numeric numbers?
1
12
123
1234
12345
123456
123456
12345
1234
123
12
1
Program 5
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();
            }
}
}

 

When the above code is compiled and executed, it produces the following result:
Output
  • How to print  Floyd’s triangle using numeric numbers?
1
212
32123
4321234
543212345
Program 6
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();
                        }


}


}

 

When the above code is compiled and executed, it produces the following result:
Example

Related Articles

Pyramid Triangle in JaVa                         Floyd,s Triangle in C
Rectangle, Square in C++                       Rectangle, Square in C
Floyd,s Triangle in C++                           Pyramid print in C++
While  loop in Java                                               While loop in C Lancuage

Nested while loop in Java                                     Nested while loop in C Language

Nested for loop in Java                                        Nested for loop in C Language
Karmehavannan

Recent Posts

Subtract two numbers using method overriding

Subtract two numbers using method overriding   Program 1

3 months ago

PHP Star triangle Pattern program

PHP Star triangle Pattern program Here's a simple Java program that demonstrates how to print…

3 months ago

Using function or method to Write temperature conversion : Fahrenheit into Celsius

Using Function or Method to Write to temperature conversion: Fahrenheit into Celsius In this article,…

1 year ago

Function or method:temperature conversion from Fahrenheit into Celsius – Entered by user

Function or method of temperature conversion from Fahrenheit into Celsius In this article, we will…

1 year ago

Write temperature conversion program: Fahrenheit into Celsius

Write temperature conversion program: from Fahrenheit to Celsius In this article, we will discuss the…

1 year ago

How to write a program to convert Fahrenheit into Celsius

How to write a program to convert Fahrenheit into Celsius In this article, we will…

1 year ago

This website uses cookies.