Write functions to compute total resistance for two resistor

Write functions to compute total resistance for two resistors connected in series and parallel. So the functions can be named as: Call these functions in the main program and display the results.

Solution

for parallel combination

#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 : n\");

   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);

}

For series combination

#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 : n\");

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);

}

 Write functions to compute total resistance for two resistors connected in series and parallel. So the functions can be named as: Call these functions in the m
 Write functions to compute total resistance for two resistors connected in series and parallel. So the functions can be named as: Call these functions in the m

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site