Monday , December 18 2017
Home / Blue J / java program for pattern#8

java program for pattern#8

 java program for pattern making:
This is a simple pattern in java where you have 4 rows:
Now the columns are dependent on number of rows.
For 1st row there is only 1 element or 1 column.
For 2nd row there are 2 elements or 2 columns
For 3rd row there are 3 elements or 3 columns.
We have to use nested for loop
So we can get the columns from the outer for loop variable. j <=i (where i is outer loop variable and j inner loop)
class format2
public static void main(String args[])
int i,j;
for(i=1;i<5;i++) // this section of code can be used in c, c++ also
{                      // only change the starting 3 lines including header files.



Tags: format in java, pattern making in java, program for pattern making in java/bluej.

Also See:   C program to add two numbers using for loop

Check Also

How to find inverse of a matrix in C programming?

In order to find inverse of a matrix in C programming, you need to know ...

Leave a Reply

Your email address will not be published. Required fields are marked *