#include <iostream>
using namespace std;
int main()
{
int M, N;
cin >> M >> N;
int quant = 0;
int sum = 0;
while (M <= N)
if (M % 3 == 0)
quant ++;
sum += M;
}
M ++;
cout << quant << " " << sum;
Copyright © 2025 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <iostream>
using namespace std;
int main()
{
int M, N;
cin >> M >> N;
int quant = 0;
int sum = 0;
while (M <= N)
{
if (M % 3 == 0)
{
quant ++;
sum += M;
}
M ++;
}
cout << quant << " " << sum;
}