Advertisement
JosepRivaille

X08783: Quàntes xifres?

Mar 5th, 2015
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. //Pre: Llegeix una seqüència de parells naturals
  6. //Post: Escriu el nombre de xifres de n en base b
  7. int main() {
  8.     int b, n;
  9.     while (cin >> b) {
  10.         cin >> n;
  11.         int count = 0;
  12.             while (n != 0) {
  13.                 n = n/b;
  14.                 ++count;
  15.             }
  16.             cout << count << endl;
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement