none
Math.Floor RRS feed

  • Question

  • I am assigning a variable imTemper1 = Math.Floor(imRandNum1 / imRandNum2) 

    The error am getting is floor is not a member of math

    I am trying to divide imRandNum1 / imRandNum2) which is fine but if num 1 = 56

    and num2 = 30 I get 2 as the result .When in actuality it is 1.8666 but I don't want

    Remainder 

    Friday, October 5, 2018 8:09 PM

Answers

  • The problem with math.floor i was able to fix by using system.math.floor
    • Marked as answer by Johnglaw Sunday, October 21, 2018 6:50 PM
    Sunday, October 14, 2018 12:02 AM

All replies

  • Hi

    Is this what you need?

        Dim imRandNum1 As Integer = 56
        Dim imRandNum2 As Integer = 30
    
        Dim imTemper1 As Integer = imRandNum1 \ imRandNum2
        ' results in imTemper1 = 1
    


    Regards Les, Livingston, Scotland

    Friday, October 5, 2018 8:35 PM
  • Hi,

    Have you declared a variable math?

    for example:

    Dim math As Integer = 1
            Dim imRandNum1 As Integer = 56
            Dim imRandNum2 As Integer = 30
            Dim Temper1 = Math.Floor(imRandNum1 / imRandNum2)

    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, October 9, 2018 7:22 AM
  • The problem with math.floor i was able to fix by using system.math.floor
    • Marked as answer by Johnglaw Sunday, October 21, 2018 6:50 PM
    Sunday, October 14, 2018 12:02 AM
  • Hi,

    I am glad you have got your solution, we appreciated you shared us your solution, we also hope you can mark it as an answer.By marking a post as Answered or Helpful, you help others find the answer faster.

    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, October 16, 2018 7:37 AM
  • The problem with math.floor i was able to fix by using system.math.floor

    What kind of app is this?  What version of .Net? 

    You might want to check your references, Math is part of the System namespace which should be in your references unless it was removed.


    "Those who use Application.DoEvents() have no idea what it does and those who know what it does never use it."

    - from former MSDN User JohnWein

    SerialPort Info

    Multics - An OS ahead of its time.

    Tuesday, October 16, 2018 2:06 PM
  • 2017 community version
    Sunday, October 21, 2018 6:52 PM
  • The app generates to random numbers using radio buttons 1-9, 10-99, and 100-999. Also selecting from radio button add, subtract, multiply, or divide. Gets input form user by text box. And compares the user answer to the generated .number added, subtracted, multiplied, or divided. It verifys. The number generated is correct and displays correct or not correct. I currently am adding a way to try again when not correct. The regular division didn't work every time because it would round I am not making the user put in the remainder of division the program also verifys the top number of add, subtract, and multiply is the larger number or switches it with division. The inside number of the division is the bigger number and the out side number is smaller. Or all of them can be equal.
    Sunday, October 21, 2018 7:05 PM