Created
January 18, 2019 19:26
-
-
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 .
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 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