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
votes
1 answer

what is the logic behind converting a number in base X to base 10

For example, 1234(base 5) when converted into base 10, is computed as : 1x5^3 + 2x5^2 + 3x5^1 + 4 Question is what is the logic behind doing this , Please Explain, Thanks in Advance.
user1718009
  • 303
  • 3
  • 7
-1
votes
1 answer

Convert 37.818 into base 10

3 x 8^1 = 24 7 x 8^0= 7 8 x 8^-1 = 1 1 x 8^-2 = 0.015625 (24+7 ) . (1.015625) = 32.015625 I'm trying to convert octal to base 10 i know there is problem with my first decimal. Should i stop at 8 x 8^-1??
P_P2622
  • 1
  • 3
-1
votes
1 answer

Can someone explain this code for me? Base-Conversion Code

So for a homework assignment we had to make a program that converted a number from one base to another (i.e. 110 in base 2 to 6 in base 10). I asked my friend how he did his because I was having trouble and he just sent me his code and nothing else.…
user2543577
  • 55
  • 1
  • 5
-1
votes
1 answer

base_convert 10 to 26 characters length

I want to create a string with the first 4 chars to be the user id and the the 4 last chars the ref id. I use base_convert() to convert the IDs to URL-friendly strings, one for the user id and one for the ref id and then I add them together to make…
George
  • 23
  • 3
-1
votes
1 answer

how can i convert decimal to hex using assembly language x86 masm

1) Convert a decimal number to hex. I dont know how to convert decimal to hex. I just input a number but i have no clue how to start next. Any help is appreciated. TITLE include irvine32.inc .data a dword ? b dword ? final dword ? count dword…
lhag
  • 13
  • 2
  • 7
-1
votes
1 answer

c++ check if string contains a character or not and how to convert a binary string into integer

I have a binary string like "01001111111". I want to know that if that string contains "0" or not. How to do that ? And if I want to convert it into integer, how to get that ?
user1838343
  • 451
  • 2
  • 8
  • 16
-2
votes
2 answers

How do I convert an integer command-line argument i to base k with bases up to 16 using the letters A through F for the digits 11-16 , respectively?

Question prompt: Modify Binary to get a program that takes two integer command-line arguments i and k and converts i to base k. Assume that i is an integer in Java’s long data type and that k is an integer between 2 and 16. For bases greater than…
-2
votes
1 answer

Need help splitting individual numbers from a starting number, then assign to integers

So I am trying to split a starting number and then assign each of those numbers to their own integers that can then be used in some equations for example: Int Starting_Number = 8056 Int Four = 8 Int Three = 0 Int Two = 5 Int One = 6 The Problem I…
Jaydon
  • 49
  • 5
-2
votes
1 answer

How to convert a string that represents a decimal number to a string that represents its binary form?

Take for example a string s="556852144786" that represents the decimal number n=556852144786. Is there a direct algorithm to transform it to s1="1000000110100110..." where 1000000110100110... is the binary representation of n?
-2
votes
2 answers

How to convert from base-36 to base-62 in plain JS with no libraries or modules

I'm looking for a JS script that will convert a base-36 number like: 23SQJ1LNEFSL00H18IVWABMP to a base-62 number like: 1rZmfPo0xtnf8CLTfWRJh I'm trying to translate this python code to do that. converter.py BASE62 =…
Let Me Tink About It
  • 15,156
  • 21
  • 98
  • 207
-2
votes
1 answer

Java how to divide in different bases?

I'm writing a program that allows conversion between base 10, base 2, and base 8. I decided to make it so that it can from any base to any base by using the method where you divide the number being converted by the base it's being converted to. The…
Inzinity
  • 41
  • 6
-2
votes
2 answers

Converting Decimal (Base 10) to its Binary (Base 2) counterpart without using parseInt

Background I'm doing a college assignment, which requires me to draw a pattern represented by 4 Hexadecimal digits. So far, I've managed to create everything I need to do it, except a little tiny thing: I have a bug in my code, which renders…
Oak
  • 693
  • 7
  • 13
-3
votes
2 answers

Convert a string of characters to an unsigned Character in C

I am searching for a way to convert a string of characters into a string of their hexadecimal representations. So the letter A will be represented as 0x41. What I am trying to do is encrypting a text file using an algorithm that encrypts hexadecimal…
-3
votes
1 answer

stoll function(c++11 string) giving ambiguous output

I encountered this problem : https://www.urionlinejudge.com.br/judge/en/problems/view/1193 /*input 3 101 bin 101 dec 8f hex */ /************************************************************* * Purpose :…
Sahil Arora
  • 875
  • 2
  • 8
  • 27
-3
votes
6 answers

A binary to decimal program

I was practicing basic programs of C and tried to do a binary to decimal conversion. Below is the code I tried but it did not produce correct results. I couldn't understand where my logic goes wrong. /* binary to decimal …
mrigendra
  • 1,472
  • 3
  • 19
  • 33
1 2 3
13
14