Farjana_akter

Untitled

Feb 12th, 2019
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. long long int product(long long int n)
  4. {
  5. if(n==0)
  6. return 10;
  7. if(n==1)
  8. return 1;
  9. long long int i,p=1,q=0;
  10. for(i=9;i>1;i--)
  11. {
  12. while(n%i==0){
  13. q+=(p*i);
  14. p*=10;
  15. n/=i;
  16. }
  17. }
  18. if(n==1)
  19. return q;
  20. else
  21. return -1;
  22.  
  23. }
  24. int main()
  25. {
  26. long long int n,a;
  27. cin>>n;
  28. a=product(n);
  29. cout<<a<<endl;
  30. return 0;
  31. }
Add Comment
Please, Sign In to add comment