Computer Science, asked by abhishekuz2000, 1 year ago

wap to print reverse number of given number in c

Answers

Answered by kirahinamoriamuchan
2

#include <stdio.h>

void main()

{

long num, reverse = 0, temp, remainder;

printf("Enter the number\n");

scanf("%ld", &num);

temp = num;

while (num > 0)

{

remainder = num % 10;

reverse = reverse * 10 + remainder;

num /= 10;

}

printf("Given number = %ld\n", temp);

printf("Its reverse is = %ld\n", reverse);

Answered by meghshah05
0

I am giving you the quick code and for a deep explanation there is a video regarding the same problem. Refer to the given channel on youtube.

MeghTheLifter

The code is here:

#include <stdio.h>

int main()

{

   //declaring the variables

   int enterednumber = 0,reversednumber = 0;

   printf("Enter the number::");

   scanf("%d",&enterednumber);

   //process for reversing the number

   while(enterednumber > 0){

       reversednumber = reversednumber*10 + enterednumber%10;

       enterednumber = enterednumber / 10;

   }

   //printing reversed number

   printf("The reversed number is ::%d",reversednumber);

   return 0;

}

Similar questions