From: Charles Krug Newsgroups: comp.os.msdos.djgpp Subject: Re: simple question :) Date: Mon, 05 Oct 1998 09:54:39 -0400 Organization: Pentek Corporation Lines: 31 Message-ID: <3618CF9F.AF228D11@mail.pentek.com> References: <36176419 DOT 4E27BA8 AT cdworld DOT co DOT uk> <6v8sbv$ghe$1 AT nnrp1 DOT dejanews DOT com> NNTP-Posting-Host: mail.pentek.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.04 [en] (WinNT; I) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp tomstdenis AT my-dejanews DOT com wrote: > > I have 2 numbers 12 (18) and > > 212 (d4) and I want to convert > > them into one number. > > > > I know the number I want is 6356 > > but i don't know how to get it. > > Can someone send me the right > > code? Actually no, you only have one number, which in C syntax is 0x18d4. Conversion between bases, especially between base 10 and base 2 or 16 is a common operation. Any math text will have the algorithm. If you must show your work, that's the route to take. You may find it useful to be able to determine the remainder from an integer division. Look at the % operator. OTOH, this is something that is commonly done in programs--debuggers, for example. Given the nature of programmers, perhaps it wouldn't surprise you to learn that the standard library will do this for you quite neatly, with little muss or fuss. If you're not required to show your work, that would be MUCH easier. Have fun! Charles