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
}
}
Loading

Sam HobbsRank #107 · 20.5K reputationPosted Mar 30, 2010, 2:01 PM EDT
So 321 in base 4 is 1+(2*4)+(3*16), correct?
Sam HobbsRank #107 · 20.5K reputationPosted Mar 30, 2010, 8:13 AM EDT
Prince12 reputationPosted Mar 30, 2010, 10:37 AM EDT