I have problem on the last line where i need to print 2 values - grams_of_fat and pounds.
What am i doing wrong since pounds are not printing out?
Printable View
I have problem on the last line where i need to print 2 values - grams_of_fat and pounds.
What am i doing wrong since pounds are not printing out?
You're calculating the result before you've input the data.Code:$ gcc -W -Wall -ansi -pedantic -O2 foo.c
foo.c: In function `main':
foo.c:21: warning: ISO C90 does not support the `%lf' printf format
foo.c:23: warning: ISO C90 does not support the `%lf' printf format
foo.c:26: warning: ISO C90 does not support the `%lf' printf format
foo.c:26: warning: ISO C90 does not support the `%lf' printf format
foo.c:29: warning: implicit declaration of function `system'
foo.c:8: warning: 'grams_of_fat' might be used uninitialized in this function
system() is in stdlib.h.
Also, printf()'s %f handles both doubles and floats. You only need %lf when scanf()'ing doubles.