/************************************************/ /* Programa Integracion_Regla_1_3_Simpson; */ /* */ /* { Para datos tabulados } */ /************************************************/ #include #include #include int Lee_Datos(void); int Nseg; float a,b; double Xi; float X[10]; float Fx[10]; /************** Programa Principal *********/ int main (void) { int i; float Base; double Area; double Sumpar = 0; double Sumimpar = 0; clrscr(); printf("\n METODO DE INTEGRACION POR 1/3 de SIMPSON "); printf("\n=================================================="); printf("\n Dada una Funcion cualesquiera"); printf("\n"); Lee_Datos(); Base = (b-a)/Nseg; Xi = a; /******** Encabezados ************/ printf("\nDatos Tabulados......."); printf("\n-------------------------"); printf("\n| i | Xi | Funcion"); printf("\n-------------------------\n"); printf("| 0 | %.2f | %.4lf",a,Fx[0]); /****** Inicia Proceso (Calculo de Sumatorias) **********/ for ( i=1; i %.8lf",Area); getche(); } int Lee_Datos(void) { printf("\n Numero de Segmentos (PAR) ="); scanf("%d",&Nseg); printf("\n Valor de a =>"); scanf("%f",&a); printf("\n Valor de b =>"); scanf("%f",&b); /********************** Cambiar los valores aqui *******************/ X[0] = 0; Fx[0]= 0; X[1] = 2; Fx[1]= 4; X[2] = 4; Fx[2]= 16; X[3] = 6; Fx[3]= 36; X[4] = 8; Fx[4]= 64; X[5] = 10; Fx[5]= 100; X[6] = 12; Fx[6]= 144; }