Write a program that queries the user for two resistor values and then calculate
ID: 3782662 • Letter: W
Question
Write a program that queries the user for two resistor values and then calculates the total resistance assuming the resistors are in series.
Write another program that queries the user for two resistors and then calculates the total resistance assuming the resistors are in parallel.
See the total resistance calculator in this folder for the flowcharts to base them on.
Start input Resistor #1 input Resistor #2 Rt R1 R2 output Rt End Start input Resistor #1 input Resistor #2 Rt R1 x R2 R1 R2 output Rt EndExplanation / Answer
1> programs are write in C++
First one is series
#include<bits/stdc++.h>
using namespace std;
int main()
{
float R1,R2;
cout<<"Enter the register Input in series ";
cin>>R1;
cin>>R2;
float Rt=R1+R2;// Total resistance
cout<<"total resistance is: "<<Rt;
}
2nd Programm resistors are in parallel
#include<bits/stdc++.h>
using namespace std;
int main()
{
float R1,R2;
cout<<"Enter the register Input in parallel";
cin>>R1;
cin>>R2;
float Rt=(R1*R2)/(R1+R2);// Total resistance
cout<<"total resistance is: "<<Rt;
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.