Skip to content

Instantly share code, notes, and snippets.

@jatinsharrma
Created March 27, 2019 13:06
Show Gist options
  • Save jatinsharrma/dacca2d6fb557eef8f8fa672b588bceb to your computer and use it in GitHub Desktop.
Save jatinsharrma/dacca2d6fb557eef8f8fa672b588bceb to your computer and use it in GitHub Desktop.
Reverse a given number
#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