About 3,410,000 results
Open links in new tab
  1. Java Program to Find Reverse of a Number Using Recursion

    Mar 12, 2024 · We can do this by extracting a unit digit from the number and then adding this extracted integer into the reversed number. But the key factor here is that we have to multiply the reversed number by 10 before adding this extracted number to the reversed number. Example: reverse(num) |__ temp = num % 10 -> extracting unit digit from number.

  2. Write a program to reverse digits of a number - GeeksforGeeks

    Mar 19, 2025 · Using Recursion. This approach uses a recursive function reverseDigits called with the number n and an accumulator variable revNum to store the reversed number, and basePos to keep track of the place value (ones, tens, hundreds, etc.).

  3. C program to find reverse of a number using recursion

    Mar 7, 2016 · Step by step descriptive logic to find reverse of a number. Multiply reverse variable by 10. Find the last digit of the given number. Add last digit just found to reverse. Divide the original number by 10 to remove last digit, which is not needed anymore.

  4. C Program to reverse a given number - BeginnersBook

    May 19, 2024 · In this article, we will learn how to write a C program to reverse a number. For example, if the given number is 1234 then program should return number 4321 as output. We will see two different ways to accomplish this. Example 1: C Program to reverse a given number using Recursion In this program,

  5. C Program to Reverse Number Using Recursive Function

    Question: Write a program in C to find reverse of a given integer number using recursive function (recursion). result = reverse(number, 0); printf("Reverse of %d is %d.", number, result); return 0; } int reverse(int num, int rev) { if(num ==0) return rev; else return reverse (num /10, rev *10 + num %10); } Reverse of 1234 is 4321.

  6. C Program to reverse the digits of a number using recursion

    Nov 29, 2022 · The reverse of the given number is 23521. Approach: Follow the steps below to solve the problem: Recursively iterate every digit of N. If the current value of N passed is less than 10, return N. if(num < 10) return N; Otherwise, after each recursive call (except the base case), return the recursive function for next iteration:

  7. Reversing a Number using Recursion in Java - PrepInsta

    Method 1 (Using Recursion) : Create a reverse(int n), a recursive function of void type. Base condition will be : if (n <10) , then print(n) and return. Otherwise, print(n%10) and call function reverse(n/10).

  8. Java Program to Reverse a Number using Recursion

    This is a Java Program to Find Reverse of a Number using Recursion. Enter any integer number as an input. After that we count the number of digits in the given input. The given number along with length of that number is passed to the other function where by using recursion we get the reverse of a number as an output.

  9. Java Program to Reverse a Number by Using Recursion

    Jan 23, 2024 · Now let’s see different ways to reverse a number by using Recursion. Method-1: Java Program to Reverse a Number By Using Static Input and Recursion. Approach: Declare an integer variable ‘ n ’ and initialize it. Call a user defined method reverseNumber() method and pass the Integer ‘ n ’ as parameter.

  10. Reverse a Given Number Using Recursive Function in C

    Explore how to reverse a number in C using a recursive function with detailed examples and explanations.

  11. Some results have been removed
Refresh