Slip 5 Q 1
Save code as "pattern.java"
5
4 5
3 4 5
2 3 4 5
1 2 3 4 5
public class pattern {
public static void main(String[] args) {
int n=5;
for (int i=n;i>0;i--){
for (int j=i;j<=n;j++){
System.out.print(j+" ");
}
System.out.println();
}
}
}
No comments:
Post a Comment