Decimal to Binary Conversion in C++

Posted by Didi Setyapramana On 7:34 PM 0 komentar

# include <stdio.h>
# include <conio.h>
# include <iostream>

toBiner void (int n)
{
  if (n> 1)
  {
  toBiner (n / 2);
  }
  cout <<n% 2;
  getch ();
}

int main ()
{
  int a;
  cout <<"Enter a number to be converted:";
  cin>> a;
  cout <<a <<"in binary is";
  toBiner (a);

  return 0;
}

Categories:

0 Response for the "Decimal to Binary Conversion in C++"

Post a Comment