Computational Physics Laboratory (2304264)
  • Computational Physics Laboratory (2304264)
  • Week 1: Introduction to C Programming
  • Week 2: More Control Flow and Functions
  • Week 3: Review and exercises
  • Week 4: Arrays (1)
  • Week 5: Arrays (2)
  • Week 6: Pointer (1)
  • Week 7: Pointer (2)
  • Week 8: Characters and Strings (1)
  • Week 9: Characters and Strings (2)
  • Week 10: Structure, Unions, Bit Manipulation and Enumerations
Powered by GitBook
On this page

Week 3: Review and exercises

Classwork - Week 3

Develop a C program that allows the user to input a polynomial function and select a root-finding method - either the Newton-Raphson method or the Bisection method. The program should then find and display the root of the polynomial based on the selected method. In addition, your program should display results from the loop in each method.

To simplify the program, you can try to focus on polynomial with upto 2nd degree in your program. Use what you have learned so far, including input-output, function, loops and control flows.

Useful function: fabs(double n) in math.h. The fabs() function takes a single argument (in double) and returns the absolute value of that number (also in double).

PreviousWeek 2: More Control Flow and FunctionsNextWeek 4: Arrays (1)

Last updated 1 year ago