Solution for Exercise 6-13
ex0613
#include <stdio.h> int main() { float a,b,c; a = 15.5; b = 3.2; c = a / b; printf("Variable c=%f\n",c); return(0); }
Notes
* The transition from Exercise 6-12 to this exercise is rather simple, just a few edits.
* You can specify any floating point values for variables a
and b
; they don't have to match what I wrote above.
* Math is done on the right side of the equation in C. The following statement is incorrect:
Don't do that.
* Remember that a floating point number must contain a decimal point! if you want to specify the value .5 you need to write it as 0.5
. Similarly, when specifying a whole number as a floating point value, write the decimal and a zero, such as 15.0
for the value 15.
Copyright © 1997-2024 by QPBC.
All rights reserved