/* * Copyright ©2022 Hannah C. Tang. All rights reserved. Permission is * hereby granted to students registered for University of Washington * CSE 333 for use solely during Spring Quarter 2022 for purposes of * the course. No other use, copying, distribution, or modification * is permitted without prior written consent. Copyrights for * third-party components of this work must be honored. Instructors * interested in reusing these course materials should contact the * author. */ #include // true/false #include // printf, scanf #include // exit(), exit codes #include "fib.h" int main(int argc, char **argv) { int n = 0, scanf_retval = 0; while (true) { printf("Which Fibonacci number would you like? "); scanf_retval = scanf("%d", &n); if (scanf_retval < 1 || n <= 0) { break; } else { printf("The %dth Fibonacci is %ld.\n\n", n, fib(n)); } } return EXIT_SUCCESS; }