14 lines
243 B
C
14 lines
243 B
C
|
#include <stdio.h>
|
||
|
|
||
|
int numbersum(int i, int p) {
|
||
|
int n = p/i;
|
||
|
return i*n*(n+1)/2;
|
||
|
}
|
||
|
|
||
|
int main( int argc, char *argv[] ) {
|
||
|
int n = 999;
|
||
|
int s = numbersum(3,n) + numbersum(5,n) - numbersum(15,n);
|
||
|
printf("%d\n",s);
|
||
|
return 0;
|
||
|
}
|