Find the error - Questions by keerthana

  • 4August
  • 2013
  • 3
    2.4k
    Debug the error its very intersting [Image: tongue.gif].Debug the program if u have the knowledge of c language

    Code:
                                                              Exponential value
    #include<stdio.h>
    #include<conio.h>
    void main()
    {
    double term=1,expo=1;
    float x;
    int i;
    clrscr();
    printf("Enter the exp value of x: ");
    scanf("%f",&x);
    for(i=1;term>=0.00001;i++);
    {
    term *= x/i;
    expo+=term;
    }
    printf("\Our Exp = %f %f\n",x,expo);
    getch();
    }
    Is it right???
    Code:
                                                              Exponential value
    #include<stdio.h>
    #include<conio.h>
    void main()
    {
    double term=1,expo=1;
    float x;
    int i;
    clrscr();
    printf("Enter the exp value of x: ");
    scanf("%f",&x);
    for(i=1;term>=0.00001;i++);
    {
    term *= x/i;
    expo+=term;
    }
    printf("\n Our Exp = %f %f\n",x,expo);
    getch();
    }
    If you want to win the world, be ready to lose yourself!!


    Rocky Welcomes you!!!! Sniper
    no for loop has terminated . It shouldnot be terminate .this is the only correction