Q:

Java Program to display the pattern with a number

0

Program to display the pattern with a number a right angle triangle by getting input from the user using for loop

 
 
 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import java.util.Scanner;
public class demo1 
{
   public static void main(String[] args)
         {
               int i,j,n;
            System.out.print("Input number of rows : ");
            Scanner input = new Scanner(System.in);
		    n = input.nextInt();
           for(i=1;i<=n;i++)
                 {
                	for(j=1;j<=i;j++)
	               System.out.print(j);  
                       System.out.println("");
                 }
         }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now