bogdan2004333

Untitled

Oct 9th, 2022
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <locale.h>
  3. #include <math.h>
  4. #include <stdlib.h>
  5. int main() {
  6. setlocale(0, "");
  7. float n;
  8. float x;
  9. float res;
  10. printf("Введите n:\n");
  11. scanf("%f",&n);
  12. printf("Введите x:\n");
  13. scanf("%f",&x);
  14. if(x<=1 && -x>=-1){
  15. for(float i=1;i<=n;i+=1){
  16. res+=pow(-1,i+1)*pow(x,i)/i;
  17. }
  18. }else{ printf("net");
  19. exit(0);}
  20. printf("Результат: %f",res);
  21. return 0;
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment