Skip to content

Instantly share code, notes, and snippets.

@sayantanHack
Created January 18, 2019 19:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sayantanHack/729f57180d99ee68a1b6950ec0da2e96 to your computer and use it in GitHub Desktop.
Save sayantanHack/729f57180d99ee68a1b6950ec0da2e96 to your computer and use it in GitHub Desktop.
This is the mirror programewhere user gives a number which is printed in a reverse order .
#include<stdio.h>
int main(void){
int n ,newNum, num4,num3,num2,num1;
printf("Enbter any Four digit number you wanna reverse : ");
scanf("%d",&n); // taking number from users
// finding the each digits of thr number.
num4 = n/1000;
num3 = (n%1000)/100;
num2 = (n%100)/10;
num1 = (n%100)%10;
printf("%d\n%d\n%d\n%d", num4,num3,num2,num1);// printing the numbers in new line
newNum= (num1*1000 + num2*100 + num3*10 +num4*1); // simple math
printf("Reverse of the number is : %d\n",newNum); // printing the reversed num
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment