Cannot implicitly convert type 'string' to 'double

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vadiraj hebbar
    New Member
    • Sep 2010
    • 1

    Cannot implicitly convert type 'string' to 'double

    public static double reversenumber(d ouble i)
    {

    i = 1 * i;

    if (i < 0)
    return i.ToString() + "is reverse number";
    else if (i > 0)
    return i.ToString() + "is reverse number";
  • MrMancunian
    Recognized Expert Contributor
    • Jul 2008
    • 569

    #2
    So what's the problem? In both cases (i<0 and i>0) you give the same message...

    Steven

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      *Your function definition says it retuns a double but you are returning a string.
      *If i is zero what happens?
      *What is the point of i=1*i?
      *Both of your test cases return the same thing
      *You will probably want a space before the is in your string

      Comment

      Working...