+ 2

What is the value of the variable a3 after execution of the following code?

string a1,a2,a3; a1="45"; a2="31"; a3=a2+a1;

1st Aug 2018, 1:25 PM
Siddhi Agarwal
3 Respostas
+ 3
ahh, how could I have missed that. it is a2+a1, not the other way around. That's why it's backwards.
2nd Aug 2018, 1:44 AM
J.G.
J.G. - avatar
+ 2
You are adding two strings together, so they will be concatenated instead of treated as numbers and added. therefore, a3=="4531" Stuff like this it would be better just to put in the code playground to test yourself.
1st Aug 2018, 1:33 PM
J.G.
J.G. - avatar
+ 2
But the answer is "3145" pls recheck it once again and then tell me :)
1st Aug 2018, 1:42 PM
Siddhi Agarwal