Solution: Use recursive to print numbers without loop.
public class PrintNumbers {
public static void main(String args[]) {
printnumbers(5);
}
public static void printnumbers(int n) {
if(n>0) {
System.out.println(n);
printnumbers(n-1);
No comments:
Post a Comment