#include <iostream>using namespace std;int n, i, s;int main(){ cin >> n; for(i = 1; i <= n; i ++) if(i % 3 == 0) s = s + i; cout << s; return 0;}
Am vazut ca doresti limbajul C standard. Ti-am refacut sursa in C.
#include <stdio.h>
int n, i, s;
int main()
{
scanf("%d", &n);
for(i = 1; i <= n; i ++)
if(i % 3 == 0) s = s + i;
printf("%d", s);
return 0;
}