Write a program that finds the equivalent series and parallel resistance for a c
ID: 670704 • Letter: W
Question
Write a program that finds the equivalent series and parallel resistance for a collection of resistor values. Your program should scan first the number of resistors and then the resistor values. Then compute the equivalent series resistance for all resistors in the collection and also the equivalent parallel resistance. For example, if there are three resistor 100, 200, and 300 ohms, respectively, their equivalent series resistance is 100 + 200 + 300 and their equivalent parallel resistance is...
use loops and cout and cin statements and cannot use #include stdio.h.
Explanation / Answer
#include <iostream>
using namespace std;
int main() {
int n,resistor,series = 0;
float parallel = 0;
cout << "Enter the number of resistors : ";
cin >> n;
for(int i=0;i<n;i++)
{
cout << "Enter the value for resistor " << (i+1) << " " ;
cin >> resistor;
series = series + resistor;
parallel = parallel+(1.0/resistor);
}
cout << "Resistor values in series is : " << series << endl;
cout << "Resistor values in parallel is : " << 1.0/parallel << endl;
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.