-Basic C Programming- The formula for calculating equivalent resistance of three
ID: 668099 • Letter: #
Question
-Basic C Programming-
The formula for calculating equivalent resistance of three resistors is given below:
Series: Rs = R1 + R2 + R3
Parallel: 1/Rp = 1/R1 + 1/R2 + 1/R3 i.e. Rp = ( 1/R1 + 1/R2 + 1/R3 ) 1
Write a C program which prompts user to enter values of R1, R2 and R3 and then it outputs Rs and Rp. Assume all are non-zero numbers.
This is as example of what your program should output
Enter values of R1, R2, and R3 (in Ohm): 3 4 5
Equivalent Resistance (in series): 12 Ohm
Equivalent Resistance (in parallel): 1.2766 Ohm
Explanation / Answer
working c code
#include<stdio.h>
int main()
{
double a,b,c;
double out,out1;
scanf("%lf",&a);
scanf("%lf",&b);
scanf("%lf",&c);
out=a+b+c;
a=(1/a);
b=(1/b);
c=(1/c);
out1 = 1/((a+b+c));
printf("In series it is %.2lf",out);
printf("In parallel it is %.2lf",out1);
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.