plz help this answer i will be very grateful to you
Attachments:
Answers
Answered by
0
Since, the question haven't mentioned about using loops in java, it's very simple.
Following same java program format, just change the code as written below while writing the print statements :
System.out.print("1 3 5 7 9");
System.out.print("1 3 5 7 ");
System.out.print("1 3 5");
System.out.print("1 3");
System.out.print("1");
Answered by
8
Answer:
Explanation:
class Pattern //class declaration
{
public static void main()
{
int i,j,k; //declaration of variables
for(i=5;i>=1;i--)//outer for-loop
{
k=1;
for (j=1;j<=i;j++)//inner for-loop
{
System.out.print(k+" ");
k=k+2;//for increment by 2 after every inner iteration
}
System.out.println();//for changing line
}
}
}
Similar questions