#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 ...
Thursday, June 2, 2011
TO FIND ANGULAR MOMENTUM OF A ROTATING BODY
#include<stdio.h>
#include<stdio.h>
#include<stdio.h>
void main()
{
int a1,a2,a3,p1,p2,p3,l1,l2,l3;
printf("Enter the componetns of distance from axis of rotation");
scanf("%d%d%d",&a1,&a2,&a3);
Printf("\nEnter the components of linear momentum");
scanf("%d%d%d",&p1,&p2,&p3);
l1=a2*p3-a3*p2;
l2=a3*p1-a1*p3;
l3=a1*p2-p1*a2;
printf("The angular momentum vector is given by %di+%dj+%dk",l1,l2,l3);
getch();
}
Algorith:
1.Start
2.Read component of distance from axis of rotation a1,a2,a3
3.Read the components of angular momentum p1,p2,p3
4.calculate
l1=a2*p3-a3*p2;
l2=a3*p1-a1*p3;l3=a1*p2-p1*a2;5.Print ...
TO FIND WORK DONE BY A FORCE
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int a1,a2,a3,f1,f2,f3,w;
printf("Enter the coefficients of force");
scanf("%d%d%d",&f1,&f2&f3);
clrscr();
printf("Enter the components of displacement\n");
scanf("%d%d%d",&a1,&a2,&a3);
w=a1*f1+a2*f2+a3*f3;
printf("Work done by the force is %d",w);
getch();
}
Algorithm:
1.Start
2.Read components of force,f1,f2,f3
3.Read components of displacement a1,a2,a3
4.Calculate the work done w=a1*f1+a2*f2+a3*f3
5.print work done
6.s ...
Algorithm of Matrix multiplication
1.Start
2.If(n not equal to p) goto step3 else goto step4
3.Print "Matrices not compatible" goto step36
4.If(n=p) goto step5 else goto step11
5.Assign i=1
6.If i<=n then i=1 and goto7 else goto11
7.If j<=n then goto8 else goto10
8.Read a[i][j]
9.Assign j=j+1 goto step7
10.Assign i=i+1 goto step6
11.Assign i=1
12.If i<=p then j=1 and goto 13 else goto14
13.If j<=q then goto12 else goto16
14.Read b[i][j]
15.Assign j=j+1 goto step13
16.Assign i=i+1 goto step12
17.Print "The product of two matrices A anb B are "
18.Assign i=1
19.If i<=m then j=1 and goto step20 else goto step24
20.If ...
Subscribe to:
Posts (Atom)