Código
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <conio.h> #include <math.h> int main () { int i, j, k, n,l; float **ecuaciones,Ex,producto,producto2,Eper; char *literales,literal; double itera[n]; for (i=0; i<n; i++) { literales[i] = '\0'; do { literales[i] = literal; } for (i=0; i<n; i++) { for (j=0; j<n; j++) { } } for (i=0; i<n; i++) { producto=0; if (ecuaciones[i][i]==0.0) { return EXIT_FAILURE; } else if(i>0) //Encuentra el primer valor de las variables que contenga el sistema { for(k=0;k<i;k++) { producto+=itera[k]*ecuaciones[i][k]; } } itera[i]=(ecuaciones[i][n]-producto)/ecuaciones[i][i]; } do { l++; for(j=0;j<n;j++) { if(j==0) //La segunda iteración de X1 { producto=0; for(k=1;k<n;k++) { producto+=itera[k]*ecuaciones[j][k]; } itera[j]=(ecuaciones[j][n]-producto)/ecuaciones[j][j]; } else if(j>0) //Corresponde a las iteraciones de las variables X2...Xn { producto=0; for(k=0;k<j;k++) { producto+=itera[k]*ecuaciones[j][k]; } producto2=0; if(j+1<n) { for(k=j+1;k<n;k++) { producto2+=itera[k]*ecuaciones[j][k]; } } itera[j]=(ecuaciones[j][n]-producto-producto2)/ecuaciones[j][j]; } } }while(Ex<=Eper); for (i=0; i<n; i++) { } return EXIT_SUCCESS; }
Mod: Los códigos deben ir en etiquetas GeSHi