Saleh127

timus 1014.c

Jun 9th, 2020
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #include <stdio.h>
  2. int main()
  3. {
  4. unsigned long long b;
  5. int a[10000],c,d,e,f,i,j=0,k,l;
  6. scanf("%llu",&b);
  7. if(b==0)
  8. {
  9. printf("10\n");
  10. }
  11. else if(b==1)
  12. {
  13. printf("1\n");
  14. }
  15. else if(b>1 && b<10)
  16. {
  17. printf("%d\n",b);
  18. }
  19. else
  20. {
  21. for(i=9;i>=2;i--)
  22. {
  23. while(b%i==0)
  24. {
  25. a[j]=i;
  26. j++;
  27. b=b/i;
  28. }
  29. }
  30. if(b!=1)
  31. {
  32. printf("-1\n");
  33. }
  34. else
  35. {
  36. for(i=j-1;i>=0;i--)
  37. {
  38. printf("%d",a[i]);
  39. }
  40. }
  41. }
  42. return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment