Is it correct like this ?
After many corrections i get this solution for this exercice
Write in C# a function with signature string ConvertDecimalToBinary(int decimal). The function should convert an integer into binary string. For example: 123 => 1111011 or 21 => 10101 The input is always positive integer.
Public String Converter (int i){
int n,j=0; String res; int[] tab,
while(i>0){
tab[j]=i%2;
i=i/2;
j++; }
For(n=tab.length;n>0;n--){
res=res+tab[n]; }
return res;
}
|