D
dmoran21
Hi all, I am a mathematician and I'm trying to write a program to try
out a formula that I've derived. However, it seems that I've got an
infinite loop and I don't quite understand why. I was hoping someone
could point me in the right direction.
Code:
#include <stdio.h>
#include <math.h>
int main()
{
float start = 0;
float end = 0;
float step = 0;
float x = 0;
float y = 0;
printf("Enter the starting value\n");
scanf("%f", &start);
printf("Enter the ending value\n");
scanf("%f", &end);
printf("Enter the step\n");
scanf("%f", &step);
for(x=start;x=end;x+=step) {
y = (pow(260,.5)/130)*cos(2*x-1.463) + (67/20)*exp(x) +
(37/52)*exp(-3*x);
printf("%3.3f %3.3f\n",x,y);
}
}
Thanks,
Dave
out a formula that I've derived. However, it seems that I've got an
infinite loop and I don't quite understand why. I was hoping someone
could point me in the right direction.
Code:
#include <stdio.h>
#include <math.h>
int main()
{
float start = 0;
float end = 0;
float step = 0;
float x = 0;
float y = 0;
printf("Enter the starting value\n");
scanf("%f", &start);
printf("Enter the ending value\n");
scanf("%f", &end);
printf("Enter the step\n");
scanf("%f", &step);
for(x=start;x=end;x+=step) {
y = (pow(260,.5)/130)*cos(2*x-1.463) + (67/20)*exp(x) +
(37/52)*exp(-3*x);
printf("%3.3f %3.3f\n",x,y);
}
}
Thanks,
Dave