Computer Science, asked by jeevan8701, 1 year ago

write a c program to reverse a given number

Answers

Answered by gp5194051
3
C program to find reverse of a number

1. #include <stdio.h>

 

2. int main()

3. {

4.  int n, reverse = 0;

 

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

   scanf("%d", &n);

 

6.   while (n != 0)

   {

  7.    reverse = reverse * 10;

      reverse = reverse + n%10;

  8.    n       = n/10;

9.   }

 

10.    printf("Reverse of entered number is = %d\n", reverse);

 

11.   return 0;

12. }


jeevan8701: output
Similar questions