import java.util.Scanner;
class IncreasingReverseHalfTriangle
{
static void increasingReverseHalfTriangle()
{
System.out.print("Enter the height of the triangle : ");
Scanner sc = new Scanner(System.in);
int height = sc.nextInt();
int height_inner = height;
for(int i = 0; i < height; i++)
{
height_inner = height;
for(int j = 0; j <= i; j++)
{
System.out.print(height_inner);
height_inner--;
}
System.out.println();
}
}
public static void main(String[] args)
{
increasingReverseHalfTriangle();
}
}
Output:
.png)
No comments:
Post a Comment