Program tinhtong;
uses crt;
var i, SUM, N : integer;
Begin
Clrscr;
Write('Nhap N: '); Readln(n);
SUM := 0; For i:=1 to N do if (i mod 3 = 0) then SUM:= SUM + i;
Write('Tong la: ', SUM);
Readln;
End.
(3+6+9+12+18+21+27+33+36+42+45+48+52+54+60+63+66++69+72+75+78+81+84+87+90+93+96+99)⋮3
#include <bits/stdc++.h>
using namespace std;
int t,i;
int main()
{
t=0;
for (i=1; i<=100; i++)
if (i%3==0) t=t+i;
cout<<t;
return 0;
}