Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. long indec(long number) {
  5. int a;//разряд
  6. int b = 0;//степень двойки
  7. int result = 0;//переведенное число
  8. while (number != 0)
  9. {
  10. a = number % 10;//разряд
  11. number = number / 10;
  12. if (b == 0)
  13.  
  14. b = 1;
  15.  
  16. if (b != 0)
  17.  
  18. a *= b;
  19.  
  20. result += a;
  21. b *= 5;
  22. }
  23. return result;
  24. }
  25.  
  26.  
  27. void dtp(int n) {
  28. if (n >= 15)
  29. dtp(n / 15);
  30. cout << n % 15;
  31. }
  32.  
  33. int main() {
  34. long number;
  35. cout << "\nnumber of pyatirichnaya = ";
  36. cin >> number;
  37. cout << "to";
  38. cout << "\ndec = " << indec(number);
  39. int n;
  40. cout << "\nnumber of dec = ";
  41. cin >> n;
  42. cout << "to";
  43. cout << "\npyatnadtsatirichnaya = ";
  44. dtp(n);
  45. return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement