LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-13-2007, 08:14 PM   #1
telnet_ping
LQ Newbie
 
Registered: Aug 2007
Distribution: debian etch
Posts: 12

Rep: Reputation: 0
Question can any one list all the methods for converting dec->Hex


i need to write a c program to convert a dec->hex
so plz list all the possible methods...
plz include algorithm for the same.....with
like .. 256/16=100
so Hex(256)=100(hx)
if possible give the fragment of code!!!
thanx
 
Old 09-13-2007, 09:11 PM   #2
nadroj
Senior Member
 
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Rep: Reputation: 60
well, as this seems like a blatant request for homework answers, my answer is 'no'. i mean, if you are in such a hurry that you cant even take the time to type complete words or sentences then i think i would waste your time.

if you want your answer now, do a search on this site as im sure it has been answered before. if not here then google might have a page or two about it, give it a search. if you want to learn how to do it, then show some effort. think about how these number systems work, give an attempt, draw it on paper. whatever you do, post back with some attempts.

Last edited by nadroj; 09-13-2007 at 09:13 PM.
 
Old 09-13-2007, 11:41 PM   #3
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
decimal and hex is the same, just another representation of the same thing
Code:
int i=10;
This is stored as 10 decimal or 0x0A hexadecimal. Have a look at the printf() functions if you want to present the data to a user. If you have to convert user input, have a look at the strtol() / strtoul() functions.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
converting a hex file to binary linx win Programming 3 07-20-2006 03:04 AM
dec to hex ewt3y Linux - General 2 08-16-2005 12:01 PM
Convert from hex to dec Ephracis Programming 3 05-30-2005 10:42 AM
C, converting hex to text Sm0k3 Programming 2 10-11-2003 04:29 AM
converting fake hex to decimal in c acid_kewpie Programming 10 08-20-2003 02:29 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration