/* Problem 1--An Inductively-Defined Function This is a pretty easy recursive program; however, it is even easier than that!! The answer can always be found by dividing the input by 2 and rounding up! */ #include #include int main (int argc, char **argv); FILE *in, *out; int main (int argc, char **argv) { int i; in = fopen ("prob1.in","r"); out = fopen ("prob1.out","w"); while (1) { fscanf (in,"%d",&i); if (i==-1) break; fprintf (out,"f(%d) = %d\n\n",i,(i+1)/2); } fclose (in); fclose (out); return EXIT_SUCCESS; }