fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. ll tcs(ll n)
  5. {
  6. ll res=0;
  7. while (n>0)
  8. {
  9. res+=n%10;
  10. n/=10;
  11.  
  12. }
  13. return res;
  14. }
  15. int main ()
  16. {
  17. ios_base::sync_with_stdio(0);
  18. cin.tie(0);
  19. ll n;
  20. cin>>n;
  21. while (gcd(n,tcs(n))==1)
  22. {
  23. n++;
  24.  
  25. }
  26. cout<<n;
  27. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:21:12: error: use of undeclared identifier 'gcd'
    while (gcd(n,tcs(n))==1)
           ^
1 error generated.
stdout
Standard output is empty