Okay so you are having trouble understanding what an int(integer) is and a float is.
Let me explain.
An integer is any hole number such as 1,2,3,4,5,6,7,8,9....and so on...
A float is any number and can hold decimal values such as:
1.0, 1.1, 1.3,2.5,2.35..
When doing mathematical operations with these datatypes such as, int, and float, there are a couple things you must keep in mind...
Consider this:
1 2 3 4 5
|
int a = 1;
float b = 1.5;
int c = 0;
c = a+b;
|
1) Integers will drop decimal values.. So variable c from above will equal 2...It will not equal 2.5. .
2) To get 2.5 you must change variable c to a float datatype to accept decimal values.
3) If you wanted to round the above integer to the nearest hole number you would apply this simple formula....
c = (a+b)+0.5;
This may look confusing at first but this is how you would round in your head.
You will run into a datatype that is called a double and that is used quiet often. A double is pretty much the same as float but can hold a greater amount of digits.
Hope this helps...