/** * function-1.c * * David J. Malan * malan@harvard.edu * * Demands that user provide a positive integer. * * Demonstrates use of a function (not from a library) with a return value. */ #include #include // prototype int GetPositiveInt(); int main(void) { int n = GetPositiveInt(); printf("Thanks for the positive int!\n", n); } /** * Gets a positive integer from a user. */ int GetPositiveInt(void) { int n; do { printf("Please give me a positive in: "); n = GetInt(); } while (n < 1); return n; }