Skip to content

Instantly share code, notes, and snippets.

@scratchyourbrain
Created December 19, 2014 09:40
Show Gist options
  • Select an option

  • Save scratchyourbrain/73974ac92ce04860cba7 to your computer and use it in GitHub Desktop.

Select an option

Save scratchyourbrain/73974ac92ce04860cba7 to your computer and use it in GitHub Desktop.
C Program to Reverse a Number
#include <stdio.h>
int main()
{
int n, reverse=0, rem;
printf("Enter an integer: ");
scanf("%d", &n);
while(n!=0)
{
rem=n%10;
reverse=reverse*10+rem;
n/=10;
}
printf("Reversed Number = %d",reverse);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment