Computer Science, asked by pranavharimohankumar, 5 months ago

5. Write a program to display the following pattern:

1 1 1 1 1

3 3 3 3

5 5 5

7 7

9

6. Write a java​

Answers

Answered by BrainlyProgrammer
3

Answer:

Question:-

  • Write a java code to display the following pattern

1 1 1 1 1

3 3 3 3

5 5 5

7 7

9

Code:-

import java.util.*;

class Code

{

public static void main(String []ar)

{

for(I=1;I<=9;I+=2)

{

for(j=1;j<=I;j++)

{

System.out.print(i) ; //we hv to print only 1 no. in same line

}

System.out.println() ; //to leave line

}

}

}

Similar questions