Advertisement
Mary_99

ex4.1

Dec 4th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.76 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4.  
  5. float fun(float A, float B, float C, float beta, float x);
  6.  
  7. int main()
  8. {
  9.  
  10.     float A,B,C,deltax,beta,e;
  11.     float x,value;
  12.  
  13.     printf("Podaj A,B,C,beta: \n");
  14.     do
  15.         scanf("%f%f%f%f",&A,&B,&C,&beta);
  16.     while(A<=0 || B<=0 || C<=0 || beta<=0);
  17.  
  18.     printf("Podaj deltax,e: \n");
  19.     do
  20.         scanf("%f%f",&deltax,&e);
  21.     while(deltax<=0);
  22.     printf("\n");
  23.  
  24.     do{
  25.         x += deltax;
  26.         value = fun(A,B,C,beta,x);
  27.         getchar();
  28.         printf(" %0.10f     -     %0.10f \n", x,value);
  29.     }while(value>e);
  30.  
  31.     printf("\n");
  32.     return 0;
  33. }
  34.  
  35. float fun(float A, float B, float C, float beta, float x){
  36.     return ( (A*pow(M_E,-x*beta)) / ((B*x*x)+C) );
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement