Created
September 9, 2014 04:07
-
-
Save raydvard/e63019a2c8c5e343e66b to your computer and use it in GitHub Desktop.
C++
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
//###################### Prac-4 ########################## // | |
// Input an integer number and output the given number in reverse between last two digits // | |
// ####################################################### // | |
#include <stdio.h> | |
int main() | |
{ | |
int num; | |
int fd, sd, td; | |
printf("Please input an integer number: "); | |
scanf("%d", &num); | |
td = num % 10; // Logic to output last digit of any integer number is to find out the reminder !! | |
num = num / 10; // then i have divide by 10 that given number to make that number 10 place downward !! | |
sd = num % 10; // then again find out the reminder of that new number to output last digit of that new number !! | |
num = num / 10; // and so on | |
fd = num % 10; | |
printf("\nThe Reverse number of the given number is: %d%d%d", td, fd, sd); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment