#include <stdio.h>

double mabs(double x){ return (x < 0)? -x : x; } 

int main(void) {
	double num = 8;
	int rootDegree = 3;

	printf("Число, корень которого считаем а = %f\n", num); 
	printf("Корень степени n = %d\n", rootDegree); 
	
	double eps = 0.00001;
	double root = num / rootDegree;
	double rn = num;
	int countiter = 0;
	while(mabs(root - rn) >= eps){
	    rn = num;
		for(int i = 1; i < rootDegree; i++){
			rn = rn / root;
		}
		root = 0.5 * ( rn + root);
		countiter++;
	}
	
	printf("root = %f\n", root); 
	printf("Число итераций = %i\n", countiter); 
	
	return 0;
}