fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int i,ichi,ju,hyaku,sen,count=0;
  5. for(i=0;i<10000;i++){
  6. ichi = i % 10;
  7. ju = (i / 10) % 10;
  8. hyaku = (i / 100) % 10;
  9. sen = (i / 1000) % 10;
  10. if ((ichi + ju + hyaku + sen) % 7 == 3)
  11. count++;}
  12. printf("%d\n", count);
  13.  
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0.01s 5284KB
stdin
9999
stdout
1433