+ 1
adding input to conversion
I've tried to combine the above formula with input, and succeeded in having no errors, but the output only says "no output"? #include <stdio.h> int main() { float average; int total; int count; scanf("%d", "%d", &total, &count); average = (float) total / count; printf("%4.2f", average); /* No errors but I receive "no output" */ return 0; }
4 Answers
+ 7
I tried your code and it seems that it will show the output if you put &total and &count in different scanf i.e :
scanf("%d",&total);
scanf("%d",&count);
+ 5
You can do it on 1 line but you shouldn't separate the format with a , you can concatenate it.
scanf("%d%d", &total, &count); should work.
+ 2
Won't be the last time where 1 character/word will cost hours of debugging time. :)
+ 1
Thanks for the help, go figure one comma ruined the whole thing!