Vidyarthiplus (V+) - Indian Students Online Education Forum

Full Version: Find the error - Questions by keerthana
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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();
}
no for loop has terminated . It shouldnot be terminate .this is the only correction
Pages: 1 2