My text wants me to calculate (volume + 165) / 166 within the last printf
I'm not including the entire program, but you will understand, I'm only showing you the last printf line.
The first thing I did was
printf (" Dimensional Weight (pounds): (volume + 165) / 166:\n") ;
output was : Dimensional Weight (pounds): (volume + 165) / 166
/*not what I was looking for*/
The second thing I did was
printf (" Dimensional Weight (pounds): (%d + 165) / 166:\n" , volume) ;
output was: Dimensional Weight (pounds): (960 + 165)/ 166
/* although the placeholder was filled in with the volume, now I just have the value of the volume, rather than the word volume, still not calculated, so not what I was looking for*/
How do I get output: Dimensional Weight (pounds): 6
I know I can have an initializer such as int weight = (volume + 165) / 166 ;
and use a placeholder for weight and get the calculation, but my book specifically asked that I (and I quote the book) "remove the weight variable, instead calculating (volume + 165) / 166 within the last printf
I'm learning this on my own from a book, I've come a long, long way in 2 days. No schools to teach C here where I'm currently living. So I give much thanks for your help, and hope you will be gracious enough to continue helping me in the future.
Thanks again, and Merry Christmas.
I'm not including the entire program, but you will understand, I'm only showing you the last printf line.
The first thing I did was
printf (" Dimensional Weight (pounds): (volume + 165) / 166:\n") ;
output was : Dimensional Weight (pounds): (volume + 165) / 166
/*not what I was looking for*/
The second thing I did was
printf (" Dimensional Weight (pounds): (%d + 165) / 166:\n" , volume) ;
output was: Dimensional Weight (pounds): (960 + 165)/ 166
/* although the placeholder was filled in with the volume, now I just have the value of the volume, rather than the word volume, still not calculated, so not what I was looking for*/
How do I get output: Dimensional Weight (pounds): 6
I know I can have an initializer such as int weight = (volume + 165) / 166 ;
and use a placeholder for weight and get the calculation, but my book specifically asked that I (and I quote the book) "remove the weight variable, instead calculating (volume + 165) / 166 within the last printf
I'm learning this on my own from a book, I've come a long, long way in 2 days. No schools to teach C here where I'm currently living. So I give much thanks for your help, and hope you will be gracious enough to continue helping me in the future.
Thanks again, and Merry Christmas.