1.

Answer please13 35 5 57 7 7 79 9 9 9 9 write a logical program using nested loopany newsense will be reported.

Answer»

\star\:\:\:\bf\large\underline\blue{Question:-}

Write a program to display the FOLLOWING pattern.

1

33

555

7777

99999

\star\:\:\:\bf\large\underline\blue{Approach:-}

import java.util.*;

class Pattern

{

public static VOID MAIN()

{

Scanner sc = new Scanner(System.in);

System.out.print("Enter the number of ROWS for the pattern: ");

int rows=sc.nextInt();

for(int i=1;i<=rows;i+=+)

{

int a=1;

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

System.out.print(a+" ");

a+=2;

System.out.println();

}

} // END of main.

} // end of class.



Discussion

No Comment Found