SOURCE: programming in c
To convert numbers you can use the printf() function
printf("%d", x'FF') hex to decimal
printf("%o", x'FF') hex to octal
If you want to save the value in another variables use sprintf
e.g
a = x'FF';
b = sprintf("%d",a)
SOURCE: Write a program that requires a positive number
Here the code in C#:
public static double whole(double num)
{
double temp=0;
do { num--; temp++; } while (num > 0);
return (temp - 1);
}
static void Main(string[] args)
{
double num, temp;
int count1=0, count2=0;
num = double.Parse(Console.ReadLine());
if (num > 0)
{
temp = num;
do { temp /= 10; count1++; } while (temp > 1);
do { num *= 10; count2++; } while (num - 1 != whole(num));
Console.Write("Left=");
Console.WriteLine(count1);
Console.Write("Right=");
Console.WriteLine(count2);
}
else
{
Console.WriteLine("Positive only!");
}
}
You can translate in to other language.
But this works only for number less then 11 digit or it's very slow.
Rate me please, thanks.
SOURCE: A bit represents how many digits in binary code
1 digit is one bit, either 1 or zero in binary, so 8 bits shows 8 digits (10001011)
SOURCE: convert hexadecimal numbers to binary
Here you go:
http://tinyurl.com/2dup7x
How about 4 thumbs??
SOURCE: Conversion Decimal to Binary back
Greetings,
Use the built-in windows calculator. (Start/Programs/Accessories/Calculator or Start/Run then type calc.exe and press Enter)
At the top click View then choose Programmer (for Win7) or Scientific mode for XP or Vista to convert.
45 views
Usually answered in minutes!
×