#include <stdio.h>

int main() {
    int P=1;
    int poly(int x) {
        return (x*x)+x-1;
    }
    void polynome(void){
        int x;
        scanf("%d\n",&x);
        P=(x*x)+x-1;
    }
    char a;
    while (a!='N') {
        scanf("%c\n",&a);
        if (a=='F')
            printf("par fonction, f(x) = %d\n\n",poly(scanf("%d\n",&P)));
        else {if (a=='P') {
            polynome();
            printf("par procedure, f(x) = %d\n",P);
            }
            else if(a!='N')
                printf("il faut ecrire P F ou N et pas %c\n\n",a);
        }
        
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: