In the following example, we’ll create a program that prints an Inverted Floyd Triangle using any character that is given as input by the user. The Program thus prints Inverted Floyd Triangle out of that character.

The basic idea is to first implement the logic of Inverted Floyd Triangle as usual and replace the Loop Control Variable that originally prints, with the input Character.

Source Code:

/* Program to print Inverted Floyd Triangle*/
import java.util.*;
class InvFloydTriangle
public static void main()
Scanner inp=new Scanner(;
System.out.print("\n Enter Any Character: ");
char c=((inp.nextLine()).charAt(0));
System.out.print("\n Enter Size Limit: ");
int n=inp.nextInt();
int i,j,k;
System.out.println("Inverted Floyd Triangle: \n");



Enter Any Character: @

 Enter Size Limit: 5
 Inverted Floyd Triangle: 


 Enter Any Character: !

 Enter Size Limit: 3
 Inverted Floyd Triangle: 


Report Error/ Suggestion

Related Posts:

CopyRight © 2020

CopyRight © 2020