Computer Science, asked by rishikushwaha, 10 months ago

Write a program to input a number and print the reverse of that number.​

Answers

Answered by lakshkon
2

Answer:

Since the programming language wasn't mentioned, I am going with the basic C.

Explanation:

C program to find reverse of a number

#include <stdio.h>

int main()

{

 int n, r = 0;

  printf("Enter a number to reverse\n");

 scanf("%d", &n);

 while (n != 0)

 {

   r = r * 10;

   r = r + n%10;

   n = n/10;

 }

 printf("Reverse of the number = %d\n", r);

 return 0;

}

Similar questions