How to Reverse Input Number in Turbo C

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

Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Popular Posts of the Week

    Optimum Creative