
12 Programming for Chemical Engineers
6 double ave;
7 printf(“ Enter three numbers\n”);
8 printf(“\n First number: “);
9 scanf(“%lf”,&num1);
10 printf(“\n Second number: “);
11 scanf(“%lf”,&num2);
12 printf(“\n Third number: “);
13 scanf(“%lf”,&num3);
14 ave=(num1+num2+num3)/3;
15 printf(“\n The average is %lf.\n”,ave);
16 system(“pause”);
17 return(0);
18 }
Lines 1, 2: Again, the #include statement tells the C compiler to use the <stdio.h>
and
<stdlib.h> header files, which contain the standard input/output
functions
printf(), scanf() and the system() function.
Line 3: The
main() function is where the main operation of the program occurs.
Lines 5, 6: Declaration ...