functii.h:
int SumaMult3(int n);
functii.cpp:
#include "functii.h"
int SumaMult3(int n){
int v = n%3;
int l = n - v;
if(v==0)
l-=3;
return l/3*(3+l)/2;//Putina matematica aici
}
main.cpp:
#include "functii.h"
#include <iostream>
using namespace std;
int main(){
int n;
cin >> n;
cout << SumaMult3(n) << '\n';
}