Skip to content

Instantly share code, notes, and snippets.

@Ambratolm
Created June 25, 2017 11:33
Show Gist options
  • Save Ambratolm/47407b37c8e0acb659e887312b919b82 to your computer and use it in GitHub Desktop.
Save Ambratolm/47407b37c8e0acb659e887312b919b82 to your computer and use it in GitHub Desktop.
Soit le polynôme ax3 + bx2 + cx +d. Ecrire un algorithme qui, demande à l’utilisateur les coefficients (a,b,c,d) d’un polynôme, le nombre x et calcule la valeur du polynôme au point x.
#include<stdio.h>
main()
{
printf("================================\n");
printf("{{ Valeur du polynôme : aX^3 + bX^2 + cX + d }}\n");
printf("================================\n");
float a,b,c,d,x,V;
printf("Entrez le coefficient a: ");
scanf("%f",&a);
printf("Entrez le coefficient b: ");
scanf("%f",&b);
printf("Entrez le coefficient c: ");
scanf("%f",&c);
printf("Entrez le coefficient d: ");
scanf("%f",&d);
printf("________________________________\n");
printf("Expression du polynôme: %f*(X^3) + %f*(X^2) + %f*(X)+ %f\n", a,b,c,d);
printf("________________________________\n");
printf("Entrez une valeur de X: ");
scanf("%f",&x);
V=(a*x*x*x)+(b*x*x)+(c*x)+d;
printf("________________________________\n");
printf("La valeur du polynôme au point X=%f est: %f\n", x,V);
printf("________________________________\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment