Example 1: Program to reverse a string Output: Example 2: Program to reverse a string entered by user Output:
Category: 4. Recursion Programs
Program to check palindrome string using recursion
Program: Check whether String is palindrome using recursion Output: Output 2:
Program to reverse a number using for, while and recursion
Program 1: Reverse a number using while Loop In this program, we are taking the input number from the user using Scanner class and then we are reversing the number using while loop. The logic we are using here is: Inside the while loop we are dividing the given number by 10 using % operator and then storing the remainder in the reversenum variable after… Continue reading Program to reverse a number using for, while and recursion