Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<math.h>
- int main()
- {
- int n, count, first, last, swap;
- printf("Enter a number: ");
- scanf("%d", &n);
- count=log10(n);
- last=n%10;
- first= n/(pow(10,count));
- swap= fmod(n,(pow(10,count)));
- swap/=10;
- printf("Swaping first and last digits: %d%d%d", last,swap,first);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment