Advertisement
nguyenhappy92

Tìm số nút xe

Oct 22nd, 2015
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. // Tim so nut xe
  2. // Khai bao cac ham thu vien neu co
  3. #include<stdio.h>
  4. #include<conio.h>
  5.  
  6. void main()
  7. {
  8. int n;
  9. scanf("%d",&n);// Nhap vao so nut xe
  10. int a;
  11. long s=0;
  12. while(n!=0)
  13. {
  14. a=n%10;
  15. s=s+a;
  16. n=n/10;
  17. }
  18. printf("%ld",(s%10));// so nut xe
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement