#include <iostream>
int main() {
using namespace std;
int n = 50; // 변수 입력
int g = 0; // 6의 배수의 합
int a = 0; // 6의 배수의 개수
for (int i = 6; i <= n; i += 6) {
cout << i << '\n'; // 6의 배수 출력
g+= i; // 합에 더하기
a++; // 개수 세기
}
cout << a << ": 6의 배수의 개수" << '\n';
cout << g << ": 6의 배수의 합" << '\n';
// int d = 0;
// for(int f = 64; f > 1; f = f / 2) {
// d++;
// }
// cout << d << ":2로 나뉜 횟수" ;
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: