#include < bits/stdc++.h >
using namespace std;
signed main(){
int sum = 0;
vector<int> a;
for(int i = 1; i <= 50; i++){
if(i % 3 == 0){
a.push_back(i);
}
for(auto &i : a){
sum += i;
cout << sum;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include < bits/stdc++.h >
using namespace std;
signed main(){
int sum = 0;
vector<int> a;
for(int i = 1; i <= 50; i++){
if(i % 3 == 0){
a.push_back(i);
}
}
for(auto &i : a){
sum += i;
}
cout << sum;
}