12,405,543 members (64,601 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 311 ppolymorphe 240 Karthik Bangalore 200 Suvendu Shekhar Giri 175 Richard Deeming 145
 OriginalGriff 7,697 ppolymorphe 3,360 Karthik Bangalore 3,327 Richard MacCutchan 2,472 F-ES Sitecore 2,300