# Need help with a Calculation

• 01-07-2006, 07:14 PM
kingbeattie
Need help with a Calculation
Well im making a calculator but i want to put this into my calculator
1=0.25
2or3=0.50
4or5=0.75
6or7=1.00
8or9=1.25
10o11=1.50
12or13=1.75
14or15=2.00
16or17=2.25
18or19=2.50
20or21=2.75
22or23=3.00
24or25=3.25
26or27=3.50

and all the way up to
98or99=12.25

Hope you understand and would like this code alot to finish my calculator
• 01-07-2006, 07:28 PM
destin
Not sure i understand... so you want when you input 26 or 27 to get 3.5?

Here's some pseudocode:
Code:

```if number is odd     result = number - 1 end if result = (result / 2.0 * .25) + .25;```
• 01-07-2006, 07:53 PM
kingbeattie
ill try this and reply i
• 01-07-2006, 07:56 PM
kingbeattie
this is what i got
Code:

```Option Explicit Private Sub Command1_click()     Dim firstNumber As Integer     Dim secondNumber As Integer     Dim thirdNumber As Integer     Dim forthNumber As Integer     Dim fithNumber As Integer     Dim Result As Integer     firstNumber = Attack.Text * 0.325     secondNumber = Strenght.Text * 0.325     thirdNumber = Deffence.Text / 4     forthNumber = Hits.Text / 4     fithNumber = Prayer.Text * 0.25     Result = firstNumber + secondNumber + thirdNumber + forthNumber + fithNumber     Text1.Text = Result End Sub```
and what i want is instead of prayer.text *0.25 i want it to go up and extra 0.25 every even number and still be same for lower odd number than it
• 01-07-2006, 08:02 PM
kingbeattie
i think you answer would work but i dont know where to put it into my code could you posibly put it in for me, thanks for helping
• 01-07-2006, 08:40 PM
destin
I probably would help you there, but I really only know Java and C/C++ :D
• 01-07-2006, 09:34 PM
Phil Weber
Try this:

fifthNumber = ((Prayer.Text \ 2) + 1) * 0.25
• 01-08-2006, 01:06 PM
kingbeattie
its alittle off,

Is thier a calculation i can use so that prayer.text would multiply only on even numbers and stay same as previous even number when it is odd? i realy need this its a vital calculation
• 01-08-2006, 01:26 PM
kingbeattie
what i want is,

if Prayer.text = odd then - 1 then *0.25
If Prayer.text = Even *0.25

I want a code that would do that i know what i typed probly isnt even code but it says what i want
• 01-08-2006, 03:57 PM
kingbeattie
ive fixed this problem but now i got anoughter :(
VB seems to be rounding up or down my numbers is thier neway of stoping this?
• 01-08-2006, 06:42 PM
Phil Weber
`As FirstNumber interget`