Jefferson Mendoza wrote:
> #include<stdio.h>
>     #include<conio.h>
>   

"conio.h" is not a standard header. You are better served by using 
standard C functions for I/O, which it appears you are anyway.

>     #include<stdlib.h>
>     #include<string.h>
>
>    #define xd 0.01
>   

My preference (yours may be different) is to define a constant, not a 
preprocessor definition. Maybe that's just the Java in me trying to get 
out, but even when I code C/C++ I try to avoid macros except where I 
cannot do something in the language itself.

>    int main()
>    {
>    int x2;
>    int y0=1;
>    int y1=0;
>
>
>
>
>     float f1(float y1, float y0);
>     float prog(void);
>    char buff[BUFSIZ];
>
>     printf("enter value of x:");
>    x2 = atof(gets(buff));
>   

At this point you are still in main() but define a nested function: this 
is illegal syntax in C.

>     /* This is the main formula */
>
>     float f1(float y1, float y0)
>    { float ans1, ans2, ans3;
>
>        ans1 = -y0;
>
>       ans2 = (ans1 * xd) +  y1;
>
>       ans3 = (y1 * xd) + y0;
>
>    return ans3;
>    }
>
>
>
>     float prog()
>         {
>
>     float x1 = xd + x2;
>   

Variable "x1" is not defined in scope at this point. Come to think of 
it, it is not defined at all.

>         do    {
>             z = f1(y1,y0);
>   

Neither is "z".

>         } while ( z >= x1 );
>
>     return x1;
>     }
>   

-- 
John Gaughan

Reply via email to