C Programs Electrical Circuit Formulae Varification

C Programs Electrical Circuit Formulae Varification

Resistance is the ratio of voltage to current. Resistance is also inversly proportional to the current. The Unit of Resistance is ohm. Resistors can be mainly connected in 2 ways in a circuit. They are

1. Resistors in Series

2. Resistors in Parallel

In series combination of resistance, the resistance are connected in series.A series circuit is A series circuit is a circuit in which resistors are arranges in a chain, so the current has only one path to take. but the voltage through the resistors varies. The total resistance of the circuit is found by simply adding up the resistance values of the individual resistors

          Equivalent Resistance(R) = R1+R2+R3+-----------Rn

Following are the programs for Electrical Circuit Formula.


--------------------------------------------------------------------------------------------------------------------------


#include<stdio.h>
int main()
{
         int r[10], num, i, Rs = 0;
         printf("Enter the number of Resistances :  ");
         scanf("%d", &num);
         printf("Enter value of each Resistance :  ");
         for(i=0;  i<num;  i++)
{
         printf("R%d  :   ", i+1);
         scanf("%d", &r[i]);
}
         for(i=0;  i<num;  i++)
{
    Rs = Rs + r[i];
}
printf("Equivalent Series Resistance  :  %d  kohm", Rs);
return (0);
}

--------------------------------------------------------------------------------------------------------------------------

Output

--------------------------------------------------------------------------------------------------------------------------

Enter the number of Resistances : 3
Enter the value of each Resistance :
R1 : 5
R2 : 4
R3 : 3
Equivalent Series Resistance : 12 Kohm

--------------------------------------------------------------------------------------------------------------------------

In case of parallel circuits the current is equally divided in the circuit, but the voltage across each resistors are the same. Here the equivalent resistance is given by the total resistance of a set of resistors in parallel is found by adding up the reciprocals of the resistance values, and then taking the reciprocal of the total.


                 
Req(1/R) = (1/R1)+(1/R2)+(1/R3)+-----(1/Rn)


--------------------------------------------------------------------------------------------------------------------------


#include<stdio.h>
int main( )
{
    int r[10], num, i, Rs = 0;
    printf("Enter the number of Resistances  :  ");
    scanf("%d", &num);
    printf("Enter value of Each Resistance  :  ");
    for(i=0; i<num; i++)
{
      printf("R%d  :  ", i+1);
      scanf("%d",  &r[i]);
}
for(i=0; i<num; i++)
{
   Rs = Rs + r[i];
}
printf(" Equivalent Series Resistance  :  %d  kohm",  Rs);
return (0);
}

--------------------------------------------------------------------------------------------------------------------------

Output

--------------------------------------------------------------------------------------------------------------------------

Enter the number of Resistances : 3
Enter the value of Each Resistance :
R1 : 4
R2 : 2
R3 : 3
Equivalent Parallel Resistance : 0.923077 kohm
 

--------------------------------------------------------------------------------------------------------------------------

Capacitance is the ability of a body to store an electric charge. The SI unit of Capacitance is the farad(F). Capacitors can be mainly connected in 2 ways in a circuit. They are

1. Capacitors in Series
2. Capacitors in Parallel

When Capacitors are connected in series, the total Capacitance is less than any one of the series Capacitors individual Capacitances. The formula for calculating the series total Capacitance is the same form as for calculating parallel resistances.

             Series Capacitances Ctotal  = 1/1/C1+1/C2+.......1/C3


--------------------------------------------------------------------------------------------------------------------------


int main( )
{
   float c[10], num, Cs=0;
   int i;
   clrscr();
   printf("Enter the number of Capacitors : ");
   scanf("%f", &num);
   printf("\n Enter value of each Capacitor : n");
     for(i=0; i<num; i++)
     {
          printf("\n c%d : ",i+1);
          scanf("%f", &c[i]);
     }
    for(i=0; i<num; i++)
    {
       Cs = Cs + (1.0/ c[i]);
    }
    Cs = 1.0/Cs;
    printf("\n Equivalent Series Combination : %f mFarad", Cs);
    return(0);
}

--------------------------------------------------------------------------------------------------------------------------

Output

--------------------------------------------------------------------------------------------------------------------------

Enter the Number Of Capacitors : 3
Enter the Value Of Each Capacitor:
C1 : 1
C2 : 1
C3 : 1
Equivalent Series Capacitance : 0.333333 mFarad

--------------------------------------------------------------------------------------------------------------------------

When Capacitors are connected in parallel, the total capacitance is the sum of the individual Capacitors Capacitances. The formula for calculating the parallel total Capacitance is the same form as for calculating series resistances.


             
Parallel Capacitances Ctotal = C1+C2+.....Cn


--------------------------------------------------------------------------------------------------------------------------


#include<stdio.h>
int main( )
{
   float c[10], num, Cp=0;
   int i;
   clrscr( );
   printf("Enter the Number of Capacitors: ");
   scanf("%f", &num);
   printf("\n Enter value of Each Capacitor: n"):
   for(i=0; i<num; i++)
  {
      printf("\n c%d: ",i+1);
      scanf("%f", &c[i]);
  }
for(i=0; i<num; i++)
{
   Cp = Cp + c[i];
}
printf("\n Equivalent parallel Capacitance : %f mFarad", Cp);
return(0);
}

--------------------------------------------------------------------------------------------------------------------------

Output

--------------------------------------------------------------------------------------------------------------------------

Enter the Number of Capacitors : 3
Enter Value Of Each Capacitor :
C1 : 1.2
C2 : 1.3
C3 : 1.4
Equivalent Parallel Capacitance : 3.900000 mFarad



EmoticonEmoticon