fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4.  
  5. long long sum = 0;
  6. long long in;
  7.  
  8. while(~scanf("%lld", &in)){
  9. if(in % 3 == 0){
  10. sum += in;
  11. }
  12. }
  13.  
  14. printf("%lld", sum);
  15.  
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0s 9424KB
stdin
5 8 3 3 9
stdout
15