Write a program to print the
following pattern using nested for
98765
9876
987
98
9
Answers
Answered by
2
Answer:
hoping you will write starting of the program
I am answering only main part
Explanation:
int i,j ;
for( i=5 ; i<=9 ; i++)
{
for( j=9 ; j>= i ; j--)
{
System.out.print(j);
}
System.out.println();
}
Answered by
0
Answer: The required java program is :-
public class Main {
public static void main(String[] args) {
for (int i=5 ; i<=9 ; i+=1) {
for (int j=9 ; j>=i ; j-=1) {
System.out.print(j);
}
System.out.println("");
}
}
}
Note :-
The above program is saved in a file named Main.java
Also, try-catch block can be used to avoid errors.
Similar questions
Business Studies,
1 month ago
Math,
1 month ago
English,
2 months ago
Computer Science,
2 months ago
Science,
9 months ago
Math,
9 months ago