//Metodo de EULER
#include<stdio.h>
#include<conio.h>
#include<math.h>
/*
Variables y funciones:
h = Incremento
n = Número de pasos
i = Un contador cualquiera
Valores iniciales xo,yo
F(x,y)= (x+y-1)ý
*/
int n,i;
float h,xo,yo,fxy;
main()
{
/* SOLICITUD DE DATOS */
clrscr();
gotoxy(3,2); printf("METODO DE EULER PARA RESOLVER Y'=F(x,y)");
gotoxy(3,3); printf("TAMAñO DEL INCREMENTO H = "); scanf("%f",&h);
gotoxy(3,4); printf(" NUMERO DE PASOS N = ");
scanf("%d",&n);
gotoxy(3,6); printf("Xo = "); scanf("%f",&xo);
gotoxy(3,7); printf("Yo = "); scanf("%f",&yo);
/* CONSTRUCCION DE LA TABLA Y CALCULO DE LOS VALORES DE X Y */
gotoxy(3,9); printf("X"); gotoxy(15,9); printf("Y");
gotoxy(3,11);printf("%.4f",xo);gotoxy(15,11);printf("%.4f",yo);
for(i=0; i<=n;i++)
{
/* SI DESEAS CAMBIAR LA FUNCION CAMBIA LO QUE ESTA DESPUE DE DE h
POR UNA ECUACION EN FUNCION DE xo,yo */
yo=yo+h*(pow(xo+yo-1,2));
xo=xo+h;
gotoxy(3,i+12); printf("%.4f",xo);
gotoxy(15,i+12); printf("%.4f",yo);
}
printf("\n\n\n http://www.geocities.com/SiliconValley/Drive/1035/programa.htm");
printf("\n Presiona una tecla para terminar");
getch();
return(0);
}
Programa fuente