int main () { int result = 0; // start with neutral element of sum operator /* this is the sum of i*3 elements below 1000, + sum of i*5 elements below 1000 minus sum of both multiples : ie i*15 elements below 1000 ∑k={1;n}k =1/2n(n+1). */ result = 3*sumOfSequence(333) + 5*sumOfSequence(199) - 15*sumOfSequence(66); printf("%i\n",result); return result; }
void statistician::print() const { cout<<"The length of the sequence is: "<<lengthSequence() << endl<< "The largest number is: " << largestNumber()<<endl<< "The smallest number is: "<<smallestNumber() << endl<< "The last number is: "<<lastNumber() << endl<< "The sum is: "<< sumOfSequence()<<endl<< "The mean of the sequence: "<<meanOfSequence()<<endl; }