Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int transformareBaza10(int b, int n) {
- int r = 0, p = 1;;
- while (n) {
- r += n % 10 * p;
- n /= 10;
- p *= b;
- }
- return r;
- }
- int main() {
- printf("%d", transformareBaza10(2, 10010));//18
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement