C++ Mania

Miscellaneous problems and features of C/C++

Tuesday, December 28, 2010

Write a C program to convert Decimal to Hex


void dec2hex(int num)
{
char hx[16]={"0123456789ABCDEF"};
if(num>15)
{
cout<<(num/16);
dec2hex(num%16);
}
else
cout<<hx[num];
}
Posted by Amit Raj at 11:07 PM
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels: Example

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Search This Blog

Links

  • Subscribe to SMS

Dennis M. Ritchie

Dennis M. Ritchie

About Me

My photo
Amit Raj
View my complete profile

Labels

  • advanced (1)
  • Concept (8)
  • Example (10)
  • First Post (1)
  • Function Overloading (1)
  • HelloWorld (1)
  • Pure Virtual Function (1)
  • Questions (1)
  • Virus using C (1)

Blog Archive

  • ▼  2010 (16)
    • ▼  December (16)
      • My First Post
      • A "Hello World" program
      • Does C supports function overloading like C++ ?
      • What's a pure virtual function ?
      • Will this code compile ?
      • Can you tell if the given number is even or odd ?
      • Can you Create a Virus in C ?
      • Can you Count the Number of bits set in an integer ?
      • Write a C program to show day and time
      • Power Of Two
      • Write a C program to convert Decimal to Hex
      • Creating CON folder in windows
      • Reading and Writing Serial Port
      • Some Good Questions
      • Can you write a program which produces own source ...
      • Can you write a program whice invoke another C pro...
  • ►  2011 (1)
    • ►  February (1)
free counters

Feed

Visits

2,911
Ethereal theme. Powered by Blogger.