fork download
  1. #include<stdio.h>
  2. #include<math.h>
  3.  
  4. float turev(int derece,int deger_dizi[],float t)
  5. {
  6. float toplam = 0;
  7.  
  8. int i;
  9. for (i = 0; i <= derece; i++)
  10. {
  11. toplam += (deger_dizi[i]*i) * pow(t,i-1);
  12. }
  13.  
  14. return toplam;
  15. }
  16.  
  17.  
  18.  
  19.  
  20. int main()
  21. {
  22. // 3*(x^2) + 4*x + 5
  23. int deger_dizi[3];
  24. deger_dizi[0] = 5;
  25. deger_dizi[1] = 4;
  26. deger_dizi[2] = 3;
  27. int sayi = 5; //sayiyi verelim
  28.  
  29. // turev 6*x + 4 olacak
  30. printf("\nSonuc : %f\n",turev(2,deger_dizi,sayi));
  31. return 0;
  32. }
  33.  
Success #stdin #stdout 0.01s 2680KB
stdin
Standard input is empty
stdout
Sonuc : 34.000000