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

This ask to use array + call by reference to calculate the Req resistor in paral

ID: 1811862 • Letter: T

Question

This ask to use array + call by reference to calculate the Req resistor in parallel and then Sum all the resistor Req ( like multi parallel resistor R1, multi resistor parallel in R2) and then sum R1+R2.

Design a program in C,using the method of call by reference, which will compute the equivalent resistance REQ to the M resistors R[0],R[1],R[2]...,R[M-1] , connected in series where the number M of resistors is user-supplied. The resistors R[0],R[1],R[2]...,R[M-1] are actually equivalent resistors to R[0]=R[00] || R[01] || R[02] ||...|| R[0(No-1)].

+R[0] is the equivalent resistance to No resistors R[00],R[01],R[02],....,R[0(No-1) connected in parallel ,where the number No is user-supplied and the resistor values R[00],R[01],R[02],....,R[0(No-1) are all user-supplied. Similarlly, for instance R[3]=R[30] || R[31] || R[32] ||...|| R[3(N3-1)]. R[3] is the equivalent resistance to N3 resistors R[30],R[31],R[32],... R[3(N3-1)] connected in parallel,where the number N3 is user supplied and the resistors values R[30],R[31],R[32],..R[3(N3-1)] are all user supplied.

Explanation / Answer

#include<stdio.h>

void series(int reg[10][10],int m,int n);

void main()

{

int reg[10][10],i,j,m,n;

printf("enter the number of register in series and parallel");

scanf("%d %d",&m,&n);

printf("enter value of reg ");

for(i=0;i<m;i++)

{

for(j=0;j<n;j++)

scanf("%d",&reg[i][j]); //input of registor value

}

series(reg,m,n);

}



void series(int reg[10][10],int m ,int n)

{

int a[10],i,j,sum=0;

for(i=0;i<m;i++) // for parallel connection

{

a[i]=0;

for(j=0;j<n;j++)

{

a[i]=a[i]*reg[i][j]/(a[i]+reg[i][j]); //calculate the equivalent parallel resistance

}

}


for(i=0;i<m;i++)

sum=sum+a[i]; // calaculate the equivalent series resistance


printf("the equivalent resistance is %d",sum); // print the equivalent resistance

}

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