Converting an Integer to Binary format
Use Convert.ToString(number, 2) to convert an integer to Binary format.
Following is the sample code:
public string IntToBinary(int num) {
return Convert.ToString(num, 2) ;
}
when you call this function passing number 3 it will return '11' and when you call this function passing number 300 it will return '100101100'.
So how's that!!!!!!!!!!!
Following is the sample code:
public string IntToBinary(int num) {
return Convert.ToString(num, 2) ;
}
when you call this function passing number 3 it will return '11' and when you call this function passing number 300 it will return '100101100'.
So how's that!!!!!!!!!!!
3 Comments:
Cool Buddy :) Keeep your good work
Regards,
Arun Ganesh
http://arun.mvpblog.com
That was good tip.
toBase
The base of the return value, which must be 2, 8, 10, or 16.
Post a Comment
<< Home