1.

Write a program to print the following 11 21 2 3 1 2 3 4 1 2 3 4 5 ​

Answer»

en problem is SOLVED USING language - Java.Here, I have assumed that the number of rows is fixed.public class Pattern{    public static VOID main(String args[]){        int n=5,i,J;        for(i=1;i<=n;i++){            for(j=1;j<=i;j++)                System.out.print(j+" ");            System.out.println();        }    }}If the number of rows is not fixed, do write the co‎de given below:import java.util.*;public class Pattern{    public static void main(String args[]){        int n,i,j;        Scanner sc=new Scanner(System.in);        System.out.print("Enter n - ");        n=sc.nextInt();        for(i=1;i<=n;i++){            for(j=1;j<=i;j++)                System.out.print(j+" ");            System.out.println();        }    }}1  1 2  1 2 3  1 2 3 4  1 2 3 4 5  See attachment for output.



Discussion

No Comment Found