Hello all this is my first post.
I'm writing a program in 'c' using lcc win32.
The program is to perform eulers calculation and store answers in arrays.
The program is to use pointers, arrays and functions.
This is the start of my program any help or tips are appreciated.
#include <stdio.h>
#include <math.h>
void calculation (float Y[], float X[], int i, float step_interval)
{
i = 0;
Y[0] = 0;
Y[0] = 1;
for (i=0; i<=step_interval; i++)
{
Y[i+1] = Y[i] + (step_interval) * (X[i] * (exp, (-X[i])));
}
for (i = 0; i <= step_interval; i++)
{
printf ("%f, %f", Y[i], X[i]);
}
}
void main()
{
float X, Y, step_size, time_interval;
int num, exp, sum, i;
printf("\n Please enter the intial conditions of 'x': ");
scanf("%f", &X);
printf("\n Please enter the intial conditions of 'y': ");
scanf("%f", &Y);
printf("\n Please enter the step size (h): ");
scanf("%f", &step_size);
printf("\n Please enter the time interval: ");
scanf("%f", &time_interval);
calculation =(X, Y, &step_size, &time_interval);
printf("\n The value of sum = %f\n\n",calculation);
}
Thank You
Code:/code



LinkBack URL
About LinkBacks


