Computer Science, asked by casmat85, 5 months ago

answer please
1

3 3

5 5 5

7 7 7 7

9 9 9 9 9

write a logical program using nested loop

any newsense will be reported.

Answers

Answered by anindyaadhikari13
3

\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.

Similar questions