Reverse a Number using C
Reverse a Number using C Programming Language
C
#include <stdio.h>
int main() {
int n, reverseNumber = 0, remainder; printf("Enter a number: ");
scanf("%d", &n); while(n != 0) {
remainder = n%10;
reverseNumber =
reverseNumber*10 + remainder; n /= 10; } printf("Reversed Number = %d", reverseNumber);
return 0; }
Comments
Post a Comment