This is giving you an incorrect answer because before asking the value of "a" and "b" from the user, you have written "c = a + (2*b) ;". You know that varible without any value will be always 0. In this program, operation has first taken place and "c" variable has been stored then you asking the user to store the value of "a" and "b", so operation answer ("c" variable value) would always be 0 + (2*0) = 0 + 0 = 0.