Thread: What is wrong with this eqaution?

  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    114

    What is wrong with this eqaution?

    Code:
    ((fourthlastnumber * 10000) + (thirdlastnumber * 1000) + (secondlastnumber * 100) + (lastnumber * 10) + currentnumber)
    If fourthlastnumber = 0,Thirdlastnumber = 0,SecondLastNumber = 0;
    Lastnumber = 1; And current number = 5;

    Shouldn't the outcome be 15?

    Well it comes out as like 105853. See an issue?
    Who needs a signature?

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    maybe it is because lastnumber and Lastnumber is different vars, or maybe another of your misspelling errors...

    show the smallest COMPILABLE example of the code that represents the problem
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  3. #3
    Registered User
    Join Date
    Jun 2008
    Posts
    114
    I have just realized that this problem is not within the eqaution for if i change the values of all the numbers before eqaution it comes out as expected. Now to bug search sorry for the false alarm.
    Who needs a signature?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 07-15-2004, 03:30 PM
  2. Debugging-Looking in the wrong places
    By JaWiB in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 11-03-2003, 10:50 PM
  3. Confused: What is wrong with void??
    By Machewy in forum C++ Programming
    Replies: 19
    Last Post: 04-15-2003, 12:40 PM
  4. God
    By datainjector in forum A Brief History of Cprogramming.com
    Replies: 746
    Last Post: 12-22-2002, 12:01 PM
  5. Whats wrong?
    By Unregistered in forum C Programming
    Replies: 6
    Last Post: 07-14-2002, 01:04 PM