In this program , i'm suppose to use the runge-kutta method to compute a math function, i won't run into details now, i'll just post my code and ask my question:

This is my code:

#include <stdio.h>

#include <math.h>

#include <ctype.h>

#include <stdlib.h>

double yprime(double x, double y);

double runge(double h, double x, double y, double (*prime)(double x, double y));

main(){

double x, y, max, h, clibrary;

double (*prime)(double x, double y);

char q[10];

puts("Enter initial values of independent variable x and dependent variable y: ");

scanf("%s %lf", &q, &y);

if(!isdigit(q[0])) {

puts("Program terminated: non-numerical entry");

exit(1);

}else

x=atof(q);

puts("Enter the maximum value of x: ");

scanf("%lf", &max);

puts("Enter the independent variable increment h: ");

scanf("%lf", &h);

for(x; x<max; x=x+h){

clibrary=sin(x);

printf("x = %.3lf y = %.7lf c library sin(x) = %.7lf\n", x, y, clibrary);

y=runge(h, x, y, yprime);

}}

double runge(double h, double x, double y, double (*prime)(double x, double y)){

double s1, s2, s3;

s1=(*prime)(x, y);

s2=(*prime)(x+h, y+h*s1);

s3=(*prime)(x+h/2.0, y+h*(s1+s2)/4.0);

y=y+h*(s1+4*s3+s2)/6.0;

return y;

}

double yprime(double x, double y){

y=sqrt(1-(y*y));

return y;

}

this is my questions:

the program should run indefinitely in a loop, until the user enters a letter of the alphabet instead of a floating point number which is requested, then the program should terminate:

How can i do that?, my program teminates after one turn(please run it if you want)

and is my numerical entry test correct !?

any other comments

I appreciate any help !

phew! out of order....

/Reminder for imladris: if you read this question, please continue on the previous one, wanna keep my promise!/

scanf("%s %lf", &q[0], &y);