This C program calculates the k-th root of a number ( x ) with specified precision ( e ). Developed during my programming course, the program implements the Newton-Raphson method to find the root.
- Input the number ( x ) for which you want to find the root.
- Specify the index ( k ) of the root (e.g., 2 for square root, 3 for cube root).
- Set the desired precision ( e ).
- Validate inputs to ensure valid calculations.
- C programming language
To compile and run the program, follow these steps:
- Clone the ropository:
git clone https://github.com/NVDIV/RootCalculator.git- Navigate to the project directory:
cd RootCalculator- Compile the program:
gcc -o root root.c- Run the program:
./rootEnter the value of x (the number to find the root of). Enter the value of k (the index of the root). Enter the precision e (in the format of 0.001). The program will calculate and display the k-th root of the number.
If you’d like to reach out, feel free to connect with me:
Thanks for visiting!