www.bilisim-egitim.tr.gg |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
e^x Fonksiyonunu Hesaplama |
|
|
ex fonksiyonunu genel terimden giderek hesaplayan program
#include <stdio.h> /* cout,cin */
#include <stdlib.h> /* EXIT_SUCCESS */
#include <math.h> /* pow */
#define TRUE 1
int main(void)
{
float x, error, term, result = 1.0;
int i = 1, f;
float fact;
printf("x: "); scanf("%f", &x);
printf("Hata: "); scanf("%f", &error);
while (TRUE)
{
fact = 1.0;
for (f = 2; f <= i; f++)
fact *= f;
term = pow(x, i) / fact;
result += term;
if (term < error)
break;
i++;
}
printf("Sonuç: %fn", result);
return EXIT_SUCCESS;
/*www.bilisim-egitim.tr.gg*/
}
|
|
|
|
|
|
|
Bugün 171 ziyaretçi (260 klik)
www.bilisim-egitim.tr.gg
|
|
|
|
|
|
|
|