Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int F(int x) {
- int a = 0, b = 10, c;
- while (x>0) {
- c = x % 10;
- a = a + c;
- if (c < b)
- b = c;
- x = x /10;
- }
- return a * 10 + b;
- }
- int main() {
- for (int w = 0; w < 1000; w++) {
- if (F(w) == 156) {
- cout << w;
- break;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement