Author: admin

  • Java Character Pattern Program

    Java Character Pattern Program

    In this tutorial, we will go through alphabet pattern programs in java programming. Before that, you may go through the following topic in java.

    Java Character Pattern Program

    import java.util.Scanner;
    
    public class Main
    {
      public static void main(String args[])
      {
        int rows, i, j, k;
        Scanner sc = new Scanner(System.in);
    
        System.out.print("Enter the no. of rows: ");
        rows = sc.nextInt();
    
        for (i = 0; i <= rows; i++)
        {
          int alphabet = 65;
          for (j = 0; j < i; j++)
            System.out.print(" ");
    
          for (k = i; k <= rows; k++)
            System.out.print((char)(alphabet + k)+" ");
    
          System.out.println();
        }
        for (i = rows; i >= 0; i--)
        {
          int alphabet = 65;
          for (j = 0; j < i; j++)
            System.out.print(" ");
    
          for (k = i; k <= rows; k++)
            System.out.print((char)(alphabet + k)+" ");
    
          System.out.println();
        }
      }
    }

    Output:

    Enter the no. of rows: 5
    A B C D E F
     B C D E F
      C D E F
       D E F
        E F
         F
         F
        E F
       D E F
      C D E F
     B C D E F
    A B C D E F

  • Right Angle Triangle Character Pattern in Java: Pattern 5

    Right Angle Triangle Character Pattern in Java: Pattern 5

    In this tutorial, we will write a program to display a right-angle triangle pattern in java using the alphabet. Before that, you may go through the following topic in java.

    The program below takes the user input from the user for the number of rows and display the right triangle character pattern in various character orders.

    Right angled triangle pattern

    import java.util.Scanner;
    
    public class Main
    {
      public static void main(String args[])
      {
        int rows, i, j;
        int ch = 64;
        Scanner sc = new Scanner(System.in);
    
        System.out.print("Enter the number of rows: ");
        rows = sc.nextInt();
    
        System.out.print("Output:\n");
        for (i = 1; i <= rows; i++)
        {
          for (j = i; j >= 1; j--)
            System.out.print((char)(j + ch)+" ");
    
          System.out.println();
        }
      }
    }

    Output:

    Enter the number of rows: 5
    Output:
    A
    B A
    C B A
    D C B A
    E D C B A


  • Right Angle Triangle Character Pattern in Java: Pattern 4

    Right Angle Triangle Character Pattern in Java: Pattern 4

    In this tutorial, we will write a program to display a right-angle triangle pattern in java using the alphabet. Before that, you may go through the following topic in java.

    The program below takes the user input from the user for the number of rows and display the right triangle character pattern in various character orders.

    Right angled triangle pattern

    import java.util.Scanner;
    
    public class Main
    {
      public static void main(String args[])
      {
        int rows, i, j;
        int ch = 64;
        Scanner sc = new Scanner(System.in);
    
        System.out.print("Enter the number of rows: ");
        rows = sc.nextInt();
    
        System.out.print("Output:\n");
        for (i = rows; i >= 1; i--)
        {
          for (j = i; j <= rows; j++)
            System.out.print((char)(j + ch)+" ");
    
          System.out.println();
        }
      }
    }

    Output:

    Enter the number of rows: 5
    Output:
    E
    D E
    C D E
    B C D E
    A B C D E


  • Right Angle Triangle Character Pattern in Java: Pattern 3

    Right Angle Triangle Character Pattern in Java: Pattern 3

    In this tutorial, we will write a program to display a right-angle triangle pattern in java using the alphabet. Before that, you may go through the following topic in java.

    The program below takes the user input from the user for the number of rows and display the right triangle character pattern in various character orders.

    Right angled triangle pattern

    import java.util.Scanner;
    
    public class Main
    {
      public static void main(String args[])
      {
        int rows, i, j;
        int ch = 64;
        Scanner sc = new Scanner(System.in);
    
        System.out.print("Enter the number of rows: ");
        rows = sc.nextInt();
    
        System.out.print("Output:\n");
        for (i = rows; i >= 1; i--)
        {
          for (j = rows; j >= i; j--)
            System.out.print((char)(j + ch)+" ");
    
          System.out.println();
        }
      }
    }

    Output:

    Enter the number of rows: 5
    Output:
    E
    E D
    E D C
    E D C B
    E D C B A


  • Right Angle Triangle Character Pattern in Java: Pattern 2

    Right Angle Triangle Character Pattern in Java: Pattern 2

    In this tutorial, we will write a program to display a right-angle triangle pattern in java using the alphabet. Before that, you may go through the following topic in java.

    The program below takes the user input from the user for the number of rows and display the right triangle character pattern in various character orders.

    Right angled triangle pattern

    import java.util.Scanner;
    
    public class Main
    {
      public static void main(String args[])
      {
        int rows, i, j;
        int ch = 64;
        Scanner sc = new Scanner(System.in);
    
        System.out.print("Enter the number of rows: ");
        rows = sc.nextInt();
    
        System.out.print("Output:\n");
        for (i = 1; i <= rows; i++)
        {
          for (j = 1; j <= i; j++)
            System.out.print((char)(j + ch)+" ");
    
          System.out.println();
        }
      }
    }

    Output:

    Enter the number of rows: 6
    Output:
    A
    A B
    A B C
    A B C D
    A B C D E
    A B C D E F


  • Inverted Right Triangle Alphabet Pattern in Java: Pattern 6

    Inverted Right Triangle Alphabet Pattern in Java: Pattern 6

    In this tutorial, we will write a java program to display the reverse right triangle pattern using the alphabet. These are character pattern programs in java. Before that, you may go through the following topic in java.

    The program below takes the user input from the user for the number of rows and displays the reverse right triangle character pattern in various character orders.

    This program can also be called the inverted half pyramid in java or Floyd’s triangle alphabet pattern in java.

    Reverse right angled triangle pattern

    In this program, the decrement of the Alphabet starts from the left corner of the pattern.

    import java.util.Scanner;
    
    public class Main
    {
      public static void main(String args[])
      {
        int rows, i, j;
        int ch = 64;
        Scanner sc = new Scanner(System.in);
    
        System.out.print("Enter the no. of rows: ");
        rows = sc.nextInt();
    
        System.out.print("Output:\n");
        for (i = 1; i <= rows; i++)
        {
          for (j = i; j <= rows; j++)
            System.out.print((char)(j + ch));
    
          System.out.println();
        }
      }
    }

    Output:

    Enter the no. of rows: 5
    Output:
    ABCDE
    BCDE
    CDE
    DE
    E


  • Inverted Right Triangle Alphabet Pattern in Java: Pattern 5

    Inverted Right Triangle Alphabet Pattern in Java: Pattern 5

    In this tutorial, we will write a java program to display the reverse right triangle pattern using the alphabet. These are character pattern programs in java. Before that, you may go through the following topic in java.

    The program below takes the user input from the user for the number of rows and displays the reverse right triangle character pattern in various character orders.

    This program can also be called the inverted half pyramid in java or Floyd’s triangle alphabet pattern in java.

    Reverse right angled triangle pattern

    import java.util.Scanner;
    
    public class Main
    {
      public static void main(String args[])
      {
        int rows, i, j;
        int ch = 64;
        Scanner sc = new Scanner(System.in);
    
        System.out.print("Enter the no. of rows: ");
        rows = sc.nextInt();
    
        System.out.print("Output:\n");
        for (i = rows; i >= 1; i--)
        {
          for (j = i; j >= 1; j--)
            System.out.print((char)(j + ch));
    
          System.out.println();
        }
      }
    }

    Output:

    Enter the no. of rows: 6
    Output:
    FEDCBA
    EDCBA
    DCBA
    CBA
    BA
    A


  • Inverted Right Triangle Alphabet Pattern in Java: Pattern 4

    Inverted Right Triangle Alphabet Pattern in Java: Pattern 4

    In this tutorial, we will write a java program to display the reverse right triangle pattern using the alphabet. These are character pattern programs in java. Before that, you may go through the following topic in java.

    The program below takes the user input from the user for the number of rows and displays the reverse right triangle character pattern in various character orders.

    This program can also be called the inverted half pyramid in java or Floyd’s triangle alphabet pattern in java.

    Pattern 4: Reverse right angled triangle pattern

    import java.util.Scanner;
    
    public class Main
    {
      public static void main(String args[])
      {
        int rows, i, j;
        int ch = 64;
        Scanner sc = new Scanner(System.in);
    
        System.out.print("Enter the no. of rows: ");
        rows = sc.nextInt();
    
        System.out.print("Output:\n");
        for (i = rows; i >= 1; i--)
        {
          for (j = 1; j <= i; j++)
            System.out.print((char)(i + ch));
    
          System.out.println();
        }
      }
    }

    Output:

    Enter the no. of rows: 5
    Output:
    EEEEE
    DDDD
    CCC
    BB
    A


  • Inverted Right Triangle Alphabet Pattern in Java: Pattern 3

    Inverted Right Triangle Alphabet Pattern in Java: Pattern 3

    In this tutorial, we will write a java program to display the reverse right triangle pattern using the alphabet. These are character pattern programs in java. Before that, you may go through the following topic in java.

    The program below takes the user input from the user for the number of rows and displays the reverse right triangle character pattern in various character orders.

    This program can also be called the inverted half pyramid in java or Floyd’s triangle alphabet pattern in java.

    Reverse right angled triangle pattern

    import java.util.Scanner;
    
    public class Main
    {
      public static void main(String args[])
      {
        int rows, i, j;
        int ch = 64;
        Scanner sc = new Scanner(System.in);
    
        System.out.print("Enter the no. of rows: ");
        rows = sc.nextInt();
    
        System.out.print("Output:\n");
        for (i = 1; i <= rows; i++)
        {
          for (j = rows; j >= i; j--)
            System.out.print((char)(i + ch));
    
          System.out.println();
        }
      }
    }

    Output:

    Enter the no. of rows: 6
    Output:
    AAAAAA
    BBBBB
    CCCC
    DDD
    EE
    F


  • Inverted Right Triangle Alphabet Pattern in Java: Pattern 2

    Inverted Right Triangle Alphabet Pattern in Java: Pattern 2

    In this tutorial, we will write a java program to display the reverse right triangle pattern using the alphabet. These are character pattern programs in java. Before that, you may go through the following topic in java.

    The program below takes the user input from the user for the number of rows and displays the reverse right triangle character pattern in various character orders.

    This program can also be called the inverted half pyramid in java or Floyd’s triangle alphabet pattern in java.

    Reverse right angled triangle pattern

    import java.util.Scanner;
    
    public class Main
    {
      public static void main(String args[])
      {
        int rows, i, j;
        int ch = 64;
        Scanner sc = new Scanner(System.in);
    
        System.out.print("Enter the no. of rows: ");
        rows = sc.nextInt();
    
        System.out.print("Output:\n\n");
        for (i = 1; i <= rows; i++)
        {
          for (j = rows; j >= i; j--)
            System.out.print((char)(j + ch));
    
          System.out.println();
        }
      }
    }

    Output:

    Enter the no. of rows: 7
    Output:


    GFEDCBA
    GFEDCB
    GFEDC
    GFED
    GFE
    GF
    G