Print following pattern in a Java
9
7 9
5 7 9
3 5 7 9
1 3 5 7 9
Answers
Answered by
2
int main()
{
int i,j;
for(i=1;i<=9;i+=2)
{
for(j=i;j<=9;j+=2)
{
printf("%d",j);
}
printf("\n");
}
return 0;
}
I hope this will help you
{
int i,j;
for(i=1;i<=9;i+=2)
{
for(j=i;j<=9;j+=2)
{
printf("%d",j);
}
printf("\n");
}
return 0;
}
I hope this will help you
Answered by
0
Answer:
class HelloWorld {
public static void main(String[] args) {
int a,b;
for(a=9;a>=1;a-=2)
{
for(b=a;b<=9;b+=2)
{
System.out.print(b+" ");
}
System.out.println();
}
}
}
Explanation:
Similar questions