Advertisement
nguyenhappy92

Hãy tìm chữ số đảo ngược của số nguyên dương n

Oct 6th, 2015
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. // Hay tim chu so dao nguoc cua so nguyen duong n
  2. //VD: 3452-> Kq=2543
  3. // Khai bao thu vien
  4. #include<stdio.h>
  5. #include<conio.h>
  6.  
  7. void main()
  8. {
  9. int n;
  10. scanf("%d",&n);
  11. long s=0;
  12. int a;
  13. while(n!=0)
  14. {
  15. a=n%10;
  16. n=n/10;
  17. s=s*10 +a;
  18. }
  19. printf("%ld",s);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement