13,147,182 members (29,151 online)
Rate this:
See more:
```#include <iostream>
using namespace std;

int main(void)
{

double f;
double C;
double L;
double pi;
double Xl;
double Xc;

cout<<"enter value of frequency";
cin>>f;
cout<<"enter value of L";
cin>>L;
cout<<"enter value of C";
cin>>C;

pi=3.14;
Xl=2*(pi*f*L);
Xc=1/(2*pi*f*C);

cout<<"Xc";

system("pause");

return 0;
}```
Posted 9-Apr-13 3:38am
Matthew Faithfull 9-Apr-13 9:48am

What makes you think there are errors?
Does it compile?
Does it run?
Does it produce a result?
Is the result correct?
Why are you using such an inacurrate value for pi?
Why are you bothering to calculate Xl and then not using it?
ThePhantomUpvoter 9-Apr-13 10:10am

What do you mean it does not show any result? You calculate the value of Xl then throw the result away. You calculate the value of Xc then throw the value away. Then you output "Xc" just like you programmed it to.

Rate this:

## Solution 6

You probably meant to say:

```cout << "Xc = " << Xc;
```

didn't you :-)
Rate this:

## Solution 3

```#include <iostream>
using namespace std;
int main(void)
{

double f=0.0;
double C=0.0;
double L=0.0;
double p=0.0;
double X=0.0;
double Xc=0.0;
double  pi=3.14;

cout<<"enter value of frequency"<<endl;
cin>>f;
cout<<"enter value of L"<<endl;
cin>>L;
cout<<"enter value of C"<<endl;
cin>>C;

X=2*(pi*f*L);
Xc=1/(2*pi*f*C);

cout<<"Final Expected Result:"<<Xc;

return 0;
}```
v2

Top Experts
Last 24hrsThis month
 OriginalGriff 230 Graeme_Grant 50 CPallini 50 RickZeeland 30 Dave Kreskowiak 25
 OriginalGriff 6,155 Graeme_Grant 5,101 ppolymorphe 1,994 Jochen Arndt 1,904 CPallini 1,855