aiNayan

4(v)

Nov 23rd, 2020 (edited)
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<math.h>
  3. int main()
  4. {
  5. int n, count, first, last, swap;
  6. printf("Enter a number: ");
  7. scanf("%d", &n);
  8. count=log10(n);
  9. last=n%10;
  10. first= n/(pow(10,count));
  11. swap= fmod(n,(pow(10,count)));
  12. swap/=10;
  13. printf("Swaping first and last digits: %d%d%d", last,swap,first);
  14. return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment