Returns zero why? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Returns zero why?

#include <stdio.h> int main() { int a,b,work; printf("enter the first value:"); scanf("%d",&a); printf("enter the second value:"); scanf("%d",&b); a+=b; printf("%d",work);

23rd Aug 2020, 8:50 AM
Chittaranjan behera
Chittaranjan behera - avatar
5 Answers
+ 4
Chittaranjan behera , the variable work is not initialized with value. Maybe you want to print the variable a, which you applied math operation.
23rd Aug 2020, 8:55 AM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 2
TheWh¡teCat 🇧🇬 in codeblocks the answer is 2 why?
23rd Aug 2020, 9:32 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 2
Samsil Arefeen , if you place the code in Playground you'll see the result => 0 with initialization error.
23rd Aug 2020, 9:39 AM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 2
Thanks TheWh¡teCat 🇧🇬 or black cat🤔.
23rd Aug 2020, 9:39 AM
The future is now thanks to science
The future is now thanks to science - avatar
0
Got it thank u the white cat
23rd Aug 2020, 8:57 AM
Chittaranjan behera
Chittaranjan behera - avatar