0% found this document useful (0 votes)
23 views

Java Number Pattern Programs

This Java program prints a number pattern of increasing integers in rows, where each row has one more number than the previous row printed with spaces between.

Uploaded by

Preeti kumari
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Java Number Pattern Programs

This Java program prints a number pattern of increasing integers in rows, where each row has one more number than the previous row printed with spaces between.

Uploaded by

Preeti kumari
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

JAVA NUMBER PATTERN PROGRAMS

import java.util.Scanner;

public class Number_Pattern

{            

        public static void main(String[] args) {

            int i, j, k = 1;

            for (i = 1; i <= 5; i++) {

                for (j = 1; j< i + 1; j++) {

                    System.out.print(k++ + ” “);

                }

                System.out.println();

            }

        }

You might also like