Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- #define comprimento 3
- int main(){
- float x[comprimento]={1,2,1/21};
- float y[comprimento];
- int i;
- for(i=0; i<comprimento; i++){
- y[i]=(1/x[i]);
- }
- int m=comprimento-1;
- float y0=y[0];
- float ym=y[m];
- float a=x[0], b=x[comprimento];
- float h=(b-a)/m //formula do intervalo
- float soma=0;
- for(i=0; i<comprimento; i++){
- soma=soma+y[i];
- }
- float I=h/2*(y0+ym+2*soma);
- printf("%f", I);
- return 0
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement