#include <iostream>
#include <string>
using namespace std;
int main() {
int N;
cin >> N;
int i = 100, count = 0;
while (i <= 999) {
string temp = to_string(i);
if ((temp[0] - '0') * (temp[1] - '0') * (temp[2] - '0') == N) {
cout << i << ", " << temp[0] << " * " << temp[1] << " * " << temp[2] << " = " << N << endl;
++count;
}
++i;
cout << "Total: " << count;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <iostream>
#include <string>
using namespace std;
int main() {
int N;
cin >> N;
int i = 100, count = 0;
while (i <= 999) {
string temp = to_string(i);
if ((temp[0] - '0') * (temp[1] - '0') * (temp[2] - '0') == N) {
cout << i << ", " << temp[0] << " * " << temp[1] << " * " << temp[2] << " = " << N << endl;
++count;
}
++i;
}
cout << "Total: " << count;
}