Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Your boss asks you to help out an electrical engineer. He\'s trying to build a c

ID: 670375 • Letter: Y

Question

Your boss asks you to help out an electrical engineer. He's trying to build a circuit using some resistors, but can't figure out what the equivalent resistance of his circuit is. You need to write a program in C to help him out.

The engineer is building a circuit with 3 resistors. Your program needs to ask him for the resistance value of each resistor, and then whether they're connected in series or in parallel.

Your program should compute the equivalent resistance of your colleague's circuit and print it to the console.

Your program should do something like the below (write the text however you want, etc)

Explanation / Answer

#include<stdio.h>

int main(){
  
   int res1,res2,res3;
   char choice;
   printf("What is the resistance of resistor 1 (in ohms)?");
   scanf("%d",&res1);
   printf("What is the resistance of resistor 2 (in ohms)?");
   scanf("%d",&res2);
   printf("What is the resistance of resistor 3 (in ohms)?");
   scanf("%d",&res3);
   printf("Are they in series, or parallel (s/p)?");
   scanf("%c",&choice);
   if(choice == 's' || choice == 'S'){
       printf("The total equivalent resistance is %d",res1+res2+res3);
   }
   else if(choice == 'p' || choice == 'P'){
       printf("The total equivalent resistance is %d",1/(1/res1+1/res2+1/res3));
   }
   return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote