Thursday, June 2, 2011

TO CHECK LCR CIRCUIT

0 comments
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int R;
float L,C,a,b,r;
printf("Enter the resistance in ohm\n");
scanf("%d",&R);
printf("Enter the inductance in Henry\n");
scanf("%f",&L);
printf("Enter the capacitance in Farad\n");
scanf("%f",&C);
a=(R*R)/(4*L*L);
b=1/(L*C);
if(a==b)
printf("The LCR circuit is critically damped");
else
{
if(a>b)
printf("The LCR circuit is over damped");
else
{
printf("The LCR circuit is under damped");
r=a-b;
w=sqrt(r);
printf("The frequency of oscillation is %f",w);
}
}
getch();
}






Algorithm:


1.start
2.Read resistance in ohms,R
3.Read inductance in henry,L
4.Read capacitance in farad,C
5.Calculate 
a=(R*R)/(4*L*L)
b=1/(L*C)
6.If a=b,print LCR circuit is critically damped
7.If a>b,print LCR circuit is over damped
8.If a<b,print LCR circuit is under damped
9.Calculate 
r=a-b
w=sqrt(r)
10.print frequency of oscillation
11.Stop


Leave a Reply