WAP to print pattern in JAVA
1 3 5 7 9
3 5 7 9
5 7 9
7 9
9
Answers
Answered by
4
Answer:
Hello friend.
class pattern
{
static void main()
{
for(int n=0,k=1;n<5;n++,k+=2)
{
int hit=k;
for(int j=n;j<5;j++,hit=hit+2)
{
System.out.print(hit+" ");
}
System.out.println();
}
}
}
/*PLEASE MARK ME AS BRAINLIEST!*/
Explanation:
Answered by
0
Answer:
for(i=1;i<10;i+=2){
for(j=i;j<10;j+=2)
System.out.println(i+" ");
System.out.println("\n");
}
Similar questions