Skip to content
Menu
Code for Java c
  • Home
  • Java
    • Java Examples
    • Java tutorials
  • C
    • C tutorials
    • C Examples
  • C++
    • C++ Tutorials
    • C++ Examples
  • Python
    • Python Tutorials
    • Python Examples
  • About
    • About me
    • contact us
    • disclaimer
    • Privacy Policy
Code for Java c

Floyd’s triangle number pattern using for loop in Java

Posted on December 7, 2016January 29, 2020

Table of Contents

  • floyd’s triangle number pattern using for loop  in Java
      • Related Articles

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
 
Floyd's triangle number pattern using for loop in Java
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:
 

 

Floyd's triangle number pattern using for loop in Java
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:
 
Floyd's triangle number pattern using for loop in Java
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:
 
Floyd's triangle number pattern using for loop in Java
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:
Floyd's triangle number pattern using for loop in Java
Example
 

Related Articles

Rectangle,Square and Table in Java          Pyramid print in C
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

Related

Recent Posts

  • Subtract two numbers using method overriding
  • PHP Star triangle Pattern program
  • Using function or method to Write temperature conversion : Fahrenheit into Celsius
  • Function or method:temperature conversion from Fahrenheit into Celsius – Entered by user
  • Write temperature conversion program: Fahrenheit into Celsius
  • How to write a program to convert Fahrenheit into Celsius

tag

Addition (6) Array (38) C++ language (91) C language (98) c sharp (23) Division (6) Function (29) if else (32) Java language (102) JavaScript (5) loops (137) Multiply (7) Oop (2) patterns (65) PHP (13) Python Language (38) Subtraction (7) temperature (20)

Archives

Categories

Address

Global information technology

Puloly south, PointPedro

Jaffna

Srilanka

©2025 Code for Java c | Powered by SuperbThemes