Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- string tothird(int n) {
- if (n < 3)
- return to_string(n);
- return tothird(n / 3) + to_string(n % 3);
- }
- int main() {
- int n;
- cin >> n;
- cout << n << "(10) = " << tothird(n) << "(3)\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement