Hi everybody,
i have a problem, i have to write a perl script to translate binar numbers to decimal and hex and the same back.
All I know is, that i have to use Operators like OR, XOR, AND, NOR... also mod, switch
It isn't allowed to use pack and sprintf.
Well the problem is, that i have no programming skills.
I know that e.g. Hex 1A2 is in Decimal 418 because i have to calulate like that
2x1 = 2
+ 10x16= 160
+ 1x256= 256
-----------------------
418
Decimal in binar e.g. Dec 40 = 101000 because
40/2 =20 left 0
20/2 =10 left 0
10/2= 5 left 0
5/2 =2 left 1
2/2 =1 left 0
1/2 =0 left 1
------------------------------
101000
and i also know that bin. in dec is e.g.bin 1010 is dec10 because
1x1² =1
+ 0x2²= 0
+ 1x3²= 9
+ 0x4² =0
------------------
10
So but know i don't know how to write an Perl script with all these infos .
Please help
Thx
rini
Recent comments
1 day 21 hours ago
2 days 6 hours ago
2 days 9 hours ago
2 days 10 hours ago
2 days 11 hours ago
2 days 13 hours ago
2 days 14 hours ago
2 days 15 hours ago
3 days 7 hours ago
3 days 8 hours ago