//Converter
//Thursday 25 2010 7:16pm
#include <stdio.h>
#include <stdlib.h>

int main ()
{
  int i;
  char buffer [33];
  
  printf ("Enter a number: ");
  scanf ("%d",&i);
  
  itoa (i,buffer,10);
  
  printf ("decimal: %s\n",buffer);
  
  itoa (i,buffer,2);
  
  printf ("binary: %s\n",buffer);
  system("pause");
  
  return 0;
  
}

Recommended Answers

All 3 Replies

So... You've got a question about this, or something?
(moved to C-forum)

  1. Use code tags.
  2. Is this a code snippet? You don't have it flagged as one.
  3. If not, what's the question?
  1. Use code tags.
  2. Is this a code snippet? You don't have it flagged as one.
  3. If not, what's the question?

Don't mention Code Snippet! They are posting enough Code Snippets already that we have to edit! :icon_twisted:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.