+ 1

Printf("the answer is %d",sum); does not work on devc++ on my PC what can i do to fix it please

Printf("the answer is %d",sum);

26th Apr 2020, 8:05 PM
Nchinda Boris
4 ответов
+ 2
Maybe you have no compiler warnings enabled in your environment. Can you try it in SoloLearns Code Playground? If the type is wrong, you will get a warning. If that doesn't help... Maybe you can share that part of your code here.
26th Apr 2020, 9:30 PM
Manu_1-9-8-5
Manu_1-9-8-5 - avatar
+ 1
What is the error you get? Might be, that - you did not #include <cstdio> - you actually typed "Printf" instead of "printf" - sum is of wrong type
26th Apr 2020, 8:17 PM
Manu_1-9-8-5
Manu_1-9-8-5 - avatar
0
I get something like 0.0000000 instead of the actual value
26th Apr 2020, 8:27 PM
Nchinda Boris
0
#include <stdio.h> int main() { int a,b,sum; printf("Enter two values\n"); scanf("%d%d",&a,&b); sum=a+b; printf ("answer is %d",sum); return 0; } This is the code
27th Apr 2020, 7:47 PM
Nchinda Boris