/***************************************************************
* File: rarith.c
* Purpose: Program to report the results
* of real arithmetic operations.
* Author: John Young
* Date: May 24, 2004
***************************************************************/
#include <stdio.h>
int main () {
double Entry1;
double Entry2;
double Result;
printf ("Enter a positive or negative real number: ");
scanf ("%lf", &Entry1);
printf ("Enter another positive or negative real number: ");
scanf ("%lf", &Entry2);
Result = Entry1 + Entry2;
printf ("%lf + %lf = %lf\n", Entry1, Entry2, Result);
Result = Entry1 - Entry2;
printf ("%lf - %lf = %lf\n", Entry1, Entry2, Result);
Result = Entry1 * Entry2;
printf ("%lf * %lf = %lf\n", Entry1, Entry2, Result);
Result = Entry1 / Entry2;
printf ("%lf / %lf = %lf\n", Entry1, Entry2, Result);
return 0;
} |