Youtube Channel

Print 1-100 numbers without using loops

public class Exam {
     void printNos(int n)
    {
      if(n > 0)
      {
        printNos(n-1);
        System.out.println(n);
      }
    }
    public static void main(String[] args) {
    Exam x=new Exam();
   
    x.printNos(100);
}
}
Next PostNewer Post Previous PostOlder Post Home