Question: Code1: #include int main(){ int res1, res2, res; printf( Enter Value of Each Resistance 1: ); scanf(%d, &res1); printf( Enter Value of Each Resistance 2:
Code1:
#include int main(){ int res1, res2, res; printf(" Enter Value of Each Resistance 1: "); scanf("%d", &res1); printf(" Enter Value of Each Resistance 2: "); scanf("%d", &res2); res = res1+res2; printf(" Equivalent Series Resistance : %d Kohm ", res); return (0); }
----------------------------------------------------------------------------------------------------------
Code2:
#include int main(){ int res1, res2, res; printf(" Enter Value of Each Resistance 1: "); scanf("%d", &res1); printf(" Enter Value of Each Resistance 2: "); scanf("%d", &res2); res = (res1*res2)/(res1+res2); printf(" Equivalent Parellel Resistance : %d Kohm ", res); return (0); }
Take the two programs and combine them into a single program(using c not c++) that uses an if and else statement to calculate R total either in series or parallel based on the users preference (ask the users which way they want the resistance calculated).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
