3
Answers

instance method that convert from otherbase to base 10

Prince

Prince

14y
2.2k
1

am writing a class, within my class i need an instance method(without using library routine) that convert from other base to base 10
private
int otherbase2Decimal(int Decimal, int otherbase)
{
//want my code to handle exception if base <2 or >10)
try
{
if ((otherbase < 2) || (otherbase > 10))
}
catch(FormatException)
{
Console.WriteLine(
"otherbase must be in range 2-10");
}

else

{
if (Decimal !=0)
{.........
return sum;// need help/code on d algorithm that will return sum as decimal num.thanks
}
}
 
Answers (3)