Computer Science, asked by vineetmishra1208, 9 months ago

print the pattern 1 35 759 791113 911131517

Answers

Answered by devildecent
0

Explanation:

KnowledgeBoat Logo

JOIN NOW

Computer Applications

Write a program in Java to display the following pattern:

1

35

579

7913

91357

Java

Java Nested for Loops

ICSE

1 Like

ANSWER

public class KboatPattern

{

public static void main(String args[]) {

for (int i = 1, x = 1; i <= 9; i = i+2, x++) {

for (int z = 5; z > x; z--) {

System.out.print(" ");

}

for (int j = i, y = 1; y <= x; j = j+2, y++) {

if (j > 9)

j = 1;

System.out.print(j);

}

System.out.println();

}

}

}

Similar questions