nicuvlad76

Untitled

Nov 5th, 2022
739
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. /**
  4.  baze de numeratie
  5.   1. transformare din b10 in bq (2<=q<=9
  6.  */
  7.  
  8. long long  n, q, n10,p;
  9.  
  10. int main()
  11. {
  12.   cin>>n >> q;
  13.   n10=0; p=1;
  14.   while( n!=0)
  15.   {
  16.       n10=n10+p*(n%q);
  17.       p*=10;
  18.       n/=q;
  19.   }
  20.   cout<<n10;
  21.   return 0;
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment