Advertisement
bombardelli

exercicio6 vetores, continuar

May 21st, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. void mostrarPolinomio(float p[10], int tam);
  5.  
  6. int main()
  7. {
  8. float pol[6] = {3, -2, 1.2, 9, -3, 11};
  9. float d1[5];
  10. int grau = 5, p = 5, i;
  11. for (i=0; i < grau; i++){
  12. d1[i] = pol[i] * p;
  13. p--;
  14. }
  15. mostrarPolinomio(pol,6);
  16. printf("\n");
  17. mostrarPolinomio(d1,5);
  18. }
  19.  
  20. void mostrarPolinomio(float p[10], int tam){
  21. int grau = tam - 1, i;
  22. for (i=0; i<tam; i++){
  23. printf("%.2fx^%d ", p[i], grau);
  24. grau--;
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement