0
A little help with this Arithmetic expression
find the value of the following expression and indicate what type of data should be the variable that stores the answer. A=12/3*(6+(30-15*3+(-3)/2)*1) When I type the code of the expression I know that it gives -40 but if I do it without the code it does not give me that answer. it confuses me on (-3) / 2
1 Answer
+ 3
If we do without code we get -3/2 = -1.5 but in case of programming language we get -1 because of data type int.
data type int contains value 1, 2, 3 and so on. Int doesn't alow decimal values.
if we declare int value like this int a = 1.5 then compiler will give error.