Program in C to reverse a given Number
Below is the C program to reverse a given number. This C program will accept a number (in a variable named “num”) and performs an operation to reverse the number. #include <stdio.h> #include <stdlib.h> int main(void) { int num=1234, newNum=0; while(num!=0){ newNum=newNum*10 + num%10; num=num/10; } printf(“\n”); printf(“%d”, newNum); return 1; } Output: 4321 Explanation: The statement while(num!=0) will be executed till value of num !=0 num%10 (read as num mod 10) will return the last digit. So in 1st iteration, it will return 4. So, newNum will become–> 0*10 + 4 –>4 Next line i.e. num/10 will return 123...