Java program to display triangle 1 24 369 481216

/* Display Triangle as follow
1
2 4
3 6 9
4 8 12 16 ... N (indicates no. of Rows) */
class Output3{
public static void main(String args[]){
int n = Integer.parseInt(args[0]);
for(int i=1;i<=n;i++){ for(int j=1;j<=i;j++){ System.out.print((i*j)+" "); } System.out.print("\n"); } } }

2 Responses to “Java program to display triangle 1 24 369 481216”

  1. Maneesha Mishra

    it’s quite good for the students to learn the basic things of java

    Reply
  2. I am not getting the desired outcome. Please check and respond with your new response.

    Reply

Leave a Reply