Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C by marco ( 14 years ago )
/*
 *  PNV-Praktikum 2 - Aufgabe 1 - Marco Kretz
 */
#include<stdio.h>
#include<math.h>

double polval(double x, double Ak[], int n) {
 int y;
 if(n > 0) {
  y = polval(x, Ak, n-1);
 } else {
  return Ak[n];
 }
 return y * x+Ak[n];
}

double fakultaet(int n) {
    double res = 1;
    int i;
    for(i=1; i<=n; i++) {
        res *= i;
    }
    return res;
}

int main() {
    printf("xttf(x)ttg(x)n");
    printf("------------------------------------n");
    double ko[21];
    double kt[] = {1, 2, 1};
    int i;
    for(i=0; i<=20; i++) {
        ko[i] = (double)1.0/fakultaet(i);
    }
    int x;
    double k;
    for(x=0; x <= 10; x++ ) {
        k = ((double)x)/5.0;
        printf ("%.2ftt%.7ett%E n", k, polval(k, ko, 20), exp(k));
    }

}

 

Revise this Paste

Your Name: Code Language: