+ 2

why I am getting different results in different environments or different languages for below program

when i write in c & run in dos,i get output as 66 when i write in java & run in command prompt,i get output as 76 import java.util.*; import java.lang.*; class increment { public static void main(String args[]) { int x=10,res; res=x++ + ++x + x++ + x++ + x++ + x++; System.out.print("result:"+res); } }

10th Feb 2018, 3:07 PM
Keerthana Vema
Keerthana Vema - avatar
2 Answers
+ 1
The answer should come as 76,i checked it
10th Feb 2018, 4:40 PM
Kevin Vaz
Kevin Vaz - avatar
+ 1
@kevin vaz but in c it's getting 66 plz run in dos prompt
11th Feb 2018, 2:53 AM
Keerthana Vema
Keerthana Vema - avatar