【課題2−1】

 

(プログラム例)

#include <stdio.h>

int main(void) {

         double x, y, z;

         char op;        /* 表示する記号('=','>','<' */

 

         printf("Input three real numbers (separate by space):");

         scanf("%lf %lf %lf", &x, &y, &z);

         if (x + y > z) {

                 op = '>';

         } else if (x + y < z) {

                 op = '<';

         } else {

                 op = '=';

         }

         printf("%4.3f + %4.3f %c %4.3f\n", x, y, op, z);

 

         return 0;

}

 

(実行例)

Input three real numbers (separate by space):1.234 2.345 3.456<enter>

1.234 + 2.345 > 3.456