Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- float ln(float X, int N) { //функция вычисления ln(1+x);
- if (fabs(pow(-1, N + 1) * (pow(X, N) / N)) <= 0.001) {
- return 0;
- }
- else {
- return ln(X, N + 1) + pow(-1, N + 1) * (pow(X, N) / N);
- }
- }
- int main()
- {
- float x,s;
- printf("vvedite x = ");
- scanf("%f",&x);
- s=ln(x,1);
- printf("ln(1+x) = %f", s);
- return 0;
- }
Add Comment
Please, Sign In to add comment