Advertisement
saira12tabassum19

Untitled

Jul 9th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.21 KB | None | 0 0
  1. //problem no 4
  2. #include<stdio.h>
  3. int main()
  4. { int n,sum=0,i;
  5. scanf("%d",&n);
  6. for(i=1;i<=n;i++)
  7. {
  8. if(i%2==0&&i%3==0)//divisible by 2 and 3
  9. {sum=sum+i;}
  10. }
  11. printf("%d\n",sum);
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement