26 lines
344 B
C
26 lines
344 B
C
|
#include <stdio.h>
|
||
|
|
||
|
// Function prototypes
|
||
|
int dividable(int n);
|
||
|
|
||
|
int main(void)
|
||
|
{
|
||
|
// Initialize variables and get input
|
||
|
int n, sum = 0;
|
||
|
scanf("%d", &n);
|
||
|
|
||
|
for (int i = 1; i < n; i++) {
|
||
|
if (dividable(i)) {
|
||
|
sum += i;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
printf("%d\n", sum * sum);
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
int dividable(int n) {
|
||
|
return (n % 3 == 0 && n % 7 == 0) ? 1 : 0;
|
||
|
}
|