Q:

C PROGRAM TO REVERSE GIVEN NUMBER:

0

C PROGRAM TO REVERSE GIVEN NUMBER:

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <stdio.h> 
 
int main()
 
{
 
   int n, rev = 0;
 
   printf("Please enter a number to reverse\n");
 
   scanf(""%d"",&n);
 
 
 
   while (n != 0)
 
   {
 
      rev = rev * 10;
 
      rev = rev + n%10;
 
      n = n/10;
 
   }
 
 
 
   printf("The reverse of entered number is %d\n", rev);
 
   return 0;
 
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now