Electrical resistors are said to be connected “in series” if the same current pa
ID: 3719636 • Letter: E
Question
Electrical resistors are said to be connected “in series” if the same current passes through each and “in parallel” if the same voltage is applied across each. If in parallel, they are equivalent to a single resistor whose resistance is given by:
1/R=(1/R1)+(1/R2)+(1/R3)+...1/Rn
Write a program that will calculate and display the equivalent resistance R for resistors in parallel based on the information obtained from the user. Assume that the user provides the following information: n = 10 and the resistance for one resistor = 1000 ohms
Use the given template below to help you write the program. YOU MUST USE A FOR LOOP.
Explanation / Answer
/* I write it in c program .. please give your positive feedback I this helps you ..if you have any doubt write to me in comment section*/
#include<stdio.h>
int main()
{
int n; /* number of resistors */
float er; /* equivalent resistance */
int r2;
int i; /* loop variable */
float temp;
printf("enter number of resistors ");
scanf("%d",&n);
printf("enter all resistances ");
scanf("%f",&er);
for(i=1;i<n;i++)
{
scanf("%d",&r2);
temp=(1/er)+((1/(float)r2)); /* cast r2 to float */
er=(1/temp);
} printf("inequivalent resistance = %f",er);
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.