/* * funcint1.c */ #include int getint(void); // function prototype: takes nothing, returns int int main(void) // header for function main: takes nothing, returns int { int aa, bb, cc; // declare 3 ints float avrg; // declare float puts("This program calculates the average of three integers.\n"); aa=getint(); // call funtion getint, assign to aa bb=getint(); // call funtion getin, assign to bb cc=getint(); // call funtion getin, assign to cc avrg=(float)(aa+bb+cc)/3; // add aa, bb, and cc, // divide result by 3.0 // Assign to float avrg printf("The average of %d, %d, and %d is %f.\n", aa,bb,cc,avrg); // output result. return 0; // return 0 to calling program } int getint(void) { int ii; // declare int printf("Type an integer and press Enter: "); // prompt for input scanf("%d", &ii); // read from stdin // interpret as a digit // assign to memory location of ii return (ii); // return value of ii to calling function }