Advertisement
nguyenhappy92

Tính tổng các số chia hết cho 4 và không chia hết cho 5

Oct 13th, 2015
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. // Tinh tong chia het cho 4 vaf khong chia het cho 5 nho hon n
  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);
  10. long s=0;
  11. for(int i=1;i<=n;i++)
  12. {
  13. if((i%4==0)&&(i%5!=0))
  14. {
  15. s=s+i;
  16. }
  17. }
  18. printf("%ld",s);
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement