0

How do you fix the following problem converting from decimal to binary?

void tobinary(int bin) {
    string binary = Convert.ToInt32(bin, 2);
}

These are the errors:

Error 2: Argument 2: cannot convert from 'int' to 'System.IFormatProvider' 42

Error 1: The best overloaded method match for 'System.Convert.ToInt32(object, System.IFormatProvider)' has some invalid arguments 42

Community
  • 1
  • 1
wtflolwut
  • 81
  • 1
  • 8

1 Answers1

0

see: Decimal to binary conversion in c #

it should be:

void tobinary(int bin) {
string binary = Convert.ToString(bin, 2);}
Community
  • 1
  • 1
abdurrahman
  • 74
  • 1
  • 6