Advertisement
nguyenhappy92

Hãy đếm số lượng chữ số lẻ của số nguyên dương n

Oct 6th, 2015
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. // Hay dem so luong chu le cua so nguyen duong n
  2. // Khai bao ham thu vien
  3. #include<stdio.h>
  4. #include<conio.h>
  5.  
  6. void main()
  7. {
  8. int n;
  9. scanf("%d",&n);
  10. int dem =0;
  11. for(int i=1;i<=n;i++)
  12. {
  13. if(i%2!=0)
  14. {
  15. dem++;
  16. }
  17. }
  18. printf("%d",dem);
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement