Questions tagged [base-conversion]

Base conversion is the process of changing the base of the textual representation of a number to another base. For example, "1010" in binary to "10" in decimal is a base conversion.

Base conversion is the process of changing the base of the textual representation of a number to another base. For example, 1010 in binary to 10 in decimal is a base conversion.

198 questions
1
vote
1 answer

Convert integer to hex with padding in Python

I have an integer (67) that needs to be converted to hex and stored as a string like: "\x00\x00\x00\x43" How can I do this in Python?
1
vote
3 answers

ask user to reenter input if there is an error in python

I am working on a program in python to convert from any number base to any number base. My code is as follows num = raw_input("Please enter a number: ") base = int(raw_input("Please enter the base that your number is in: ")) convers =…
chadybear
  • 119
  • 2
  • 10
1
vote
5 answers

character array is not getting printed using %s

1.While I am trying to display conv it is not showing anything, but when i print one one element using subscript i am able to see the contents. 2. Program to convert decimal to binary, octal, hexadecimal #include int main() { …
Daemon
  • 1,575
  • 1
  • 17
  • 37
1
vote
2 answers

Base 10 to Base 32 Conversion

I have a routine that converts base10 to bas32 and what is interesting that when I double check some numbers using online conversion tools there seems to be an issue. Here are some numbers and the results of my conversion: 9990330227991015 =…
Russell Weetch
  • 113
  • 1
  • 3
  • 12
1
vote
1 answer

What might be causing my results to print out in reverse of what they should?

This is my last lab of this set for while/do-while loops and I've got it all figured out aside from my result printing out in the exact reverse of what it should be. public class TenToAny { private int base10; private int newBase; public…
tech_geek23
  • 229
  • 2
  • 10
  • 23
1
vote
0 answers

Convert a number in base B to binary

I have a very large string (around 1000 characters) and its represented in base B. Whats the best way to convert it to binary representation since I can't use any arithmetic operators. This is an interview practice question and I just want to clear…
Pranava Sheoran
  • 529
  • 4
  • 27
1
vote
3 answers

How to convert base64 to base10 in PHP?

I currently convert base10 numbers to base64 in PHP. but I haven't any idea for convert base64 to base10 in php! How can I do it? my algorithm for convert base10 to base64: $rep =…
0
votes
2 answers

ICertRequest2::Submit CSR data Compatability ASCII to BSTR

I have my certrequest as a PEM base64 data. See data below. 1) My understanding is that this is an ASCII data type and not in UNICODE format. Please clarify. -----BEGIN NEW CERTIFICATE…
Raj
  • 1,113
  • 1
  • 17
  • 34
0
votes
1 answer

Algorithm for converting an arbitrarily long String representing a decimal number into a String representing a hexadecimal number

I am currently working on a program in C17, which receives a string from the command line, lets call it st_in. I know that st_in will only contain chars in range [0x30, 0x39], thus represent a decimal number of arbitrary size. I want to convert this…
0
votes
1 answer

Converting a BigInteger to a string in some base: speed issue (Kotlin)

I want to convert large positive BigIntegers (up to many thousands of digits) to strings in Kotlin, using number bases up to 100 (and possibly higher). For bases ≤36, there is of course toString(base), but for larger bases, I wrote this extension…
Anypodetos
  • 13
  • 5
0
votes
1 answer

How can I loop through a string in x86_64 assembly NASM?

I ask the user to give me a number. I receive that number as a string and I want to iterate through each char of the string to check its content. I have written this code where numero_a_convertir is the pointer to the string the user gave me: ;*…
Guido
  • 11
  • 1
0
votes
2 answers

Number base conversion returning (-ve) value

I am self-learning Java programming and I was trying to do some number conversion from base 10 to any base, but I keep getting a negative value with the code below import java.lang.Math; import java.util.Scanner; public class NumberSystemConversion…
wyatrich
  • 1
  • 1
0
votes
1 answer

How To Do Direct Conversion From One Number Base To A New Number Base

I want to understand direct conversion from one number base to a different number base. What are the steps that work for any number base to another number base? What I am looking for is not a short cut method which works for say, binary to octal or…
Shalini
  • 3
  • 2
0
votes
1 answer

Why does this algorithm convert decimal to hexadecimal numbers?

I can't quite seem to figure out how does such algorithm work... Code: #include int main(void){ int number = 0; while(number < 16){ if(number < 10){ printf("decimal: \t%d\n", number); printf("hexadec.: \t%c\n", number +…
user13343210
0
votes
1 answer

Converting from any base(1-61) to any(1-61) in Haskell

I need to write a code, that will translate from any base to any( for 1 base it's Turing machine). I should realize 3 functions using only base library: 1)toDecimal base snumber - convert string number to string decimal number 2)fromDecimal toBase…
user17221096