Computer Science, asked by bkumar0823, 1 year ago

Write a java programe to print the following Patter Using Loops:-
1
3 3 3
5 5 5 5 5
7 7 7 7 7 7 7
9 9 9 9 9 9 9 9 9

without using ScannerScan

Answers

Answered by prakriti27
2
class Loops
{
void main(int n)   
{
int i, j;
for(i=1;i<=n;i++)
{
if(i%2!=0)
{
for(j=1;j<=i;j++)
{
System.out.print(i);
}
System.out.println();
}
}
}
}
Answered by sk181231
13

Answer:

{\bold{\green{\underline{ ★ \: UPSC - Aspirant \:★ }}}}

Que : Write a java programe to print the following Patter Using Loops:-

1

3 3 3

5 5 5 5 5

7 7 7 7 7 7 7

9 9 9 9 9 9 9 9 9

Solution :

1 - 1 Time (1)

3 - 3 Time(333)

5 - 5 Time (55555)

7 - 7 Time (7777777)

9 - 9 Time (999999999)

The Loops are following in pattern .

Similar questions