If x = 2 then after executing the statement “ x = x + x + +” the value of x will be | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
- 2

If x = 2 then after executing the statement “ x = x + x + +” the value of x will be

23rd Apr 2020, 4:16 AM
Salman Hanif Safi
Salman Hanif Safi - avatar
1 Respuesta
+ 2
It will result in 4 it is better if you use (x++). Because initially x=2 and after that x= 2+2 because you used post increment value so first 2 will be added and then x will be increased by 1.
23rd Apr 2020, 4:26 AM
Ayush Kumar
Ayush Kumar - avatar