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
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
Chemistry,
2 months ago
English,
2 months ago
Computer Science,
5 months ago
Science,
11 months ago
English,
11 months ago