TheQuack45

Project Euler Problem 1

Jun 14th, 2016
427
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.26 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. #define ZERO 0
  4. #define THREE 3
  5. #define FIVE 5
  6. #define LIM 1000
  7.  
  8. main()
  9. {
  10.     int c, sum;
  11.     sum = ZERO;
  12.    
  13.     for (c = THREE; c < LIM; c++)
  14.     {
  15.         if (c % THREE == ZERO || c % FIVE == ZERO)
  16.         {
  17.             sum += c;
  18.         }
  19.     }
  20.    
  21.     printf("%d", sum);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment