Home Segments Index Top Previous Next

21: Mainline

To relieve the sample program of a portion of its catatonia, you can provide statements that tell the C compiler that you want the results of the computation to be displayed, as in the following revised program:

#include  
main ( ) { 
  printf ("The average of the prices is "); 
  printf ("%f", (10.2 + 12.0 + 13.2) / 3); 
  printf ("\n"); 
} 

The revised program introduces several concepts and syntactical markers, and forces the introduction of the line #include <stdio.h>. Accordingly, you need to zoom in, and to look at the revised program piece by piece.