Advertisement
totobac

Untitled

Jan 16th, 2022
737
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. int pow(int a, int b)
  2. {
  3.     int result = a;
  4.     while (b != 1)
  5.     {
  6.         result *= a;
  7.         b--;
  8.     }
  9.     return result;
  10. }
  11.  
  12. unsigned long long int createInterestingNum(int n)
  13. {
  14.     if (n == 1)
  15.         return n;
  16.  
  17.     unsigned long long int num = createInterestingNum(n - 1);
  18.     int multiplFactor = pow(10, pow(2, n - 1));
  19.  
  20.     return  num * multiplFactor + n * (multiplFactor / 10) + num;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement