Q:

Java Program to print a pattern like right angle triangle with repeated number

0

Program to print a pattern like right angle triangle with repeated number 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 n : ");
            	Scanner input = new Scanner(System.in);
		   n = input.nextInt();
 
                for(i=1;i<=n;i++)
                     {
	                 for(j=1;j<=i;j++)
	                 System.out.print(i);
	                 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