Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- void main()
- {
- double radicand, start, quotient, next_value, precision, result;
- int max;
- system("clear");
- printf("Radicand: ");
- scanf("%lf", &radicand);
- if(radicand > 10000000){
- printf("This radicand is too big!\n");
- }
- else{
- system("clear");
- start = radicand / ((radicand + 1) / 4);
- quotient = radicand / (start * start);
- next_value = ((quotient + 2 * start) / 3);
- if(radicand <= 10){
- max = 5;
- }
- else if(radicand > 10){
- max = 25;
- }
- else if(radicand > 100){
- max = 100;
- }
- for(precision = 1; precision <= max; precision++){
- system("clear");
- result = radicand / (next_value * next_value);
- next_value = ((result + 2 * next_value) / 3);
- if(precision == max){
- printf("Cube root oot of %.5lf is %.5lf\n", radicand, next_value);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement