+ 2
What will z equal?
int x=5; int y=4; int z= x/y;
5 Antworten
+ 2
mesarthim 5 divided by 4 is 1 (with reminder 1)
C++ does not convert the numbers to floats and perform the real division
(like it does not do that for addition, subtraction and multiplication),
it directly performs the Euclidean division
(like it directly performs the integer addition, subtraction and multiplication)
+ 3
It's 1 because you are taking value in integer
+ 2
𝕥𝕖𝕤𝕝𝕒✨
z will be 1 because x and y are int
+ 1
[EDITED] You defined variable z as integer so it must be 1.
Happy coding!
+ 1
Oh, that's right Angelo. Thanks for explanation, I must be careful more.