/* Exercise 1-2 Starting Solution */
/*
1) Take the the two variables X and X and change them to
two other variable names. Make sure your variable names
are different than your lab partners.
2) Change the variable names from "int" to "float"
observe what happens and record the results via comments.
*/
#include <stdio.h>
int main ( void )
{
float numerator,denominator; /* define first number */
/* define second number */
printf( "Enter two numbers: "); /* prompt user */
scanf( "%f %f", &numerator, &denominator ); /* read values from keyboard */
/* output results */
printf( "The sum is %f\n", numerator + denominator );
printf( "The product is %f\n", numerator * denominator );
printf( "The difference is %f\n", numerator - denominator );
printf( "The quotient is %f\n", numerator / denominator );
printf( "The remainder is %f\n", numerator % denominator );
return 0; /* indicate successful termination */
} /* end main */
Building main.obj.
E:\Documents and Settings\dee\My Documents\Pelles C Projects\Lab 1-2\main.c(52): error #2168: Operands of '%' have incompatible types 'float' and 'float'.
E:\Documents and Settings\dee\My Documents\Pelles C Projects\Lab 1-2\main.c(52): warning #2234: Argument 2 to 'printf' does not match the format string; expected 'double' but found 'int'.
*** Error code: 1 ***
Done.
/b]