0
1.1kviews
Write a java program

Write a java program to print the following pattern (take input for number of rows from the command line)

1

1 2

1 2 3

1 2 3 4

Mumbai University > Information Technology > Sem 3 > Object Oriented Programming Methodology

Marks: 10M

Year: May 2016

1 Answer
0
2views
Import java.io.*;
Class NumberTriangle
{
    Public static void main (String args[]) 
    {

        Int num = Integer.parseInt(args[0]));
        for (int i=1; i<=num; i++)
        {
            for(int j=1; j<=i; j++)
            {
                System.out.println (ā€œ+i+ā€);
            }
            System.out.println(ā€œ\nā€);
        }
    }
}
Please log in to add an answer.