Prince

Prince

  • NA
  • 12
  • 0

instance method that convert from otherbase to base 10

Mar 30 2010 8:45 AM

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)