## functions in c

can somebody help me on writting a program that displays yo
to yn+1 when n=100 and store them in a file.
y"=cos(t)*y+y
y(0)=1
y'(0)=0
h=0.1
y'=z
z'=z'*cos(t)+y
yn+1=zn+h*zn*(cos(tn))+yn)
tn=t+nh
 PhysOrg.com science news on PhysOrg.com >> New language discovery reveals linguistic insights>> US official: Solar plane to help ground energy use (Update)>> Four microphones, computer algorithm enough to produce 3-D model of simple, convex room
 i have the above using for loop without declaring any fuction, if someone knows how to solve it including user defined function then he might be able to help me. thank you! the one i wrote is showed below #include #include #include main() { FILE *fp; fp=fopen("D:\\cop.txt","w"); float y[100],dy[100],z[100],h,t[100]; int i; y[0]=1; z[0]=0; h=0.1; t[0]=0; for(i=0;i<100;i++) { t[i]=t[0]*i*h; y[i+1]=y[i]+h*z[i]; z[i+1]=z[i]+h*((z[i]*cos (t[i]))+y[i]); } fprintf(fp,"i\tz(n+1)\t\ty(n+1)\n\n"); printf("i\tz(n+1)\t\ty(n+1)\n\n"); for(i=0;i<100;i++) { fprintf(fp,"%d\t%f\t%f\n",i,z[i+1],y[i+1]); printf("%d\t%f\t%f\n",i,z[i+1],y[i+1]); } fclose(fp); system("PAUSE"); }

 Similar discussions for: functions in c Thread Forum Replies Calculus 3 Precalculus Mathematics Homework 2 Set Theory, Logic, Probability, Statistics 4 Calculus & Beyond Homework 6 Precalculus Mathematics Homework 2