+ 5
Can someone explain what's the difference between 7.0 and 7?
For examle 7.0/2+3.5 and 7/2+3.5 why is this giving different values?
10 Answers
+ 13
Using dot you say to program that its a float number so he will keep numbers after dot as well ( 7.0/2 = 3.5) otherwise he is working with an integer so (7/2 = 3) =)
+ 5
đđ Felix Gautsch after visual studio 17 its necessary to write f
+ 3
7.0 is a float number, whereas 7 is a decimal number. Your output type would be same as your input type:
7.0 / 2 = 3.5
7 / 2.0 = 3.5
7.0 / 2.0 = 3.5
7/2 = 3
+ 2
Can you share the code with us ?
+ 2
Data types - the first is float and the second is intđ€
+ 2
Whenever u see a decimal point then it's a float and returns value in float..
Without decimal point is integer
+ 2
Krysto Foxik đ„ Using dot means that it's a *double*, not a *int* or float value.. with an f, it's a float value, for example 7.0f đđ»
+ 1
can you share the code đ€đ€
+ 1
My question would be: Is it bad I usually ignore the format of a number/word/text/whatever? (as in float or integer etc...)
+ 1
The difference is between the data type. '7' is an int, but '7.0' can be float or decimal.