Created
March 27, 2019 13:06
-
-
Save jatinsharrma/dacca2d6fb557eef8f8fa672b588bceb to your computer and use it in GitHub Desktop.
Reverse a given number
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int reverse(int a){ | |
int temp = 0 ; | |
int reverse = 0; | |
while (a != 0){ | |
temp = a % 10; | |
reverse = reverse*10 + temp; | |
a = a/10; | |
} | |
return reverse; | |
} | |
void main() { | |
int a; | |
a = reverse(132564); | |
printf("%d",a); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment