Wednesday, January 7, 2026

Java program to print increasing half triangle pattern.


//Java program to print increasing half triangle pattern.
import java.util.Scanner;

class IncreasingTriangle
{
static void increasingTriangle()
{
System.out.print("Enter the height of the triangle :");
Scanner sc = new Scanner(System.in);
int height = sc.nextInt();
//Nested for loops to print the two dimensional pattern.
for(int i = 0; i < height; i++)
{
for(int j = 1; j<= i+1; j++)
{
System.out.print(j);
}
//Introduce a new line.
System.out.println();
}
}
public static void main(String[] args)
{
increasingTriangle();
}

}

👆Java program to print increasing triangle pattern.
Output:



No comments:

Post a Comment

47000 has 2 significant figures while 47000.000 has 8 significant figures...why? when both are the same value.

  Significant figures refer to the digits in a measured or calculated value that carry meaningful information about its precision .  They in...