Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <locale.h>
- #include <math.h>
- #include <stdlib.h>
- int main() {
- setlocale(0, "");
- float n;
- float x;
- float res;
- printf("Введите n:\n");
- scanf("%f",&n);
- printf("Введите x:\n");
- scanf("%f",&x);
- if(x<=1 && -x>=-1){
- for(float i=1;i<=n;i+=1){
- res+=pow(-1,i+1)*pow(x,i)/i;
- }
- }else{ printf("net");
- exit(0);}
- printf("Результат: %f",res);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment