How to print even numbers without using any loopin java??only in 15 lines..
Let's assume by "how" you mean logic not the code itself. Try making it by yourself for better Practice. You have to use recursive function to print even numbers without loop. Here goes the logic, create a function, check if argument is less then whatever end point you want to print upto e.g. 20, 30, 40 . . . Then check if argument variable % 2 is zero or not so you will get if it's even or odd. Print it if even else just call the function itself with argument + 1
Asrar Ali How you can say only in 15 lines. I think you know the logic. 😁😁
Asrar Ali Can you show your code?
Thanks bro, i try myself thanks for help
Na bro i try myself but i cant
This question should've tagged 'Java' instead of 'hasnain'.