The program has to be written in C
The expected output:
Please make sure to use two-dimensional arrays.
#include <stdio.h>
int main(int argc, char const *argv[])
{
int branch,resistor;
double VB, r[50][50], req[50]={0}, total_eq=0,eq;
printf("Please enter value for battery voltage VB in volts:
");
scanf("%lf",&VB);
printf("Please enter value for number m of branches: ");
scanf("%d",&branch);
printf("\n");
for (int i = 0; i < branch; ++i)
{
printf("Please enter the number of resistors n in brach %d : ",
i);
scanf("%d",&resistor);
for (int j = 0; j < resistor ; ++j)
{
printf("Please enter a value of resistor r[%d][%d] in ohms:
",i,j);
scanf("%lf", &(r[i][j]));
req[i]+=r[i][j];
printf("Equivalent resistance #%d in branch #%d is r[%d] = ",
i,j,j);
printf("%lf ohms \n", r[i][j]);
}
printf("Result: Equiv. resistance to resistors in brach #%d is =%f
ohms \n \n", i, req[i]);
total_eq+=req[i];
}
eq=total_eq/VB;
printf("\n Equiv. resistance seen by battery req= %lf ohms \n",
eq);
printf("Current & power supplied by battery are: IB = %lf A,
PB= %lf W\n", VB/eq , (VB/eq)*VB);
for (int i = 0; i < branch; ++i)
printf("Current in and power dissipated in branch %d are I[%d]=%lf
A, P[%d]= %lf W \n", i, i, VB/req[i], (VB/req[i])*VB);
return 0;
}
Output:
The program has to be written in C The expected output: Please make sure to use...
The present quiz is concerned with making calculations on the circuit shown below which consists of: an ideal battery with user-supplied terminal voltage V_0: and a user-supplied number m of branches of resistors which are connected in series within each branch, with these branches connected in parallel across each other, and with each branch consisting of a variable user-supplied number n of resistors and user-supplied values of the resistors. Design two programs in C, one using the method of call...
Please use MATLAB to solve this, thanks 7. Write a function M-file that will compute the equivalent resistance for a series or parallel combination of an arbitrary number of resistors. Your function should: accept as input an arbitrary number of resistor values, stored in a vector ask the user to input 'p' if the resistors are in parallel; ask the user to input 's' if the resistors are in series; output the equivalent resistance for the series or parallel combination...
Use MATLAB to solve these problems, thank u Task 1 The equivalent resistance Req of four resistors R1, R2, R3 and R4 connected in series is given as eq.series R1 R2 R3 R4. The equivalent resistance Req of four resistors R1, R2, R3 and R4 connected in parallel is given as q.parallel K1R2R3 R Write an m-file that does the following in order: Prompt the user for the type of connection (e.g. user should enter "1" for series and "2"...
*Answer must be in C* Write a complete program as follows (declare any necessary variables): Create an array of doubles named “hummus” with 2 rows and 300 columns. Initialize all array elements to zero. Write a loop that will repeatedly ask the user to enter a value and store it in the first row of the array (do not overwrite previously entered values) until the whole first row is populated with the user input. (hint the loop should have the...
Problem: Create a program that will ask scientist in tracking the resistances of products from various batches. The resistances of good resistors should be between 3 and 3.5 inclusive. Your program will need to track the number of resistances that are too high (>3.5 ohms), the number of resistances that are too low (<3.0ohms) and calculate the average of the resistances that fall in the proper range (>=3 and <= 3.5). Your program should prompt the user to enter name...
Program in C++! Thank you in advance! Write a menu based program implementing the following functions: (1) Write a function that prompts the user for the name of a file to output as a text file that will hold a two dimensional array of the long double data type. Have the user specify the number of rows and the number of columns for the two dimensional array. Have the user enter the values for each row and column element in...
Motes Ask Your Teacher 10. 0/12 points| Previous Ansiwers PSEB 2B.AF.a4 Active Figure 28.4 Resistors Connected in Series The animation below shows a circuit diagram for two resistors connected in series acrass a battery Instructions Use the sliders to adjust the resistances and battery voltage and observe the effect on the current and voltages across each resistor. Explore In the animation, the two resistors are connected directly to the battery, so they both share a portion of the battery voltage...
In C++ 1. Write a program that allows a user to enter 10 integer values from the keyboard. The values should be stored in an array. 2. The program should then ask the user for a number to search for in the array: The program should use a binary search to determine if the number exists in a list of values that are stored in an array (from Step #1). If the user enters a number that is in the...
use C++ to write the following program. needs to ask the user for n The user must put in those 5 values, probably using a for loop. NOTE: You can assume the number of values to be entered is 5. My attempted program below: (not correct, but just a basis) 4. Larger Than n In a program, write a function that accepts three arguments: an array, the size of the array, and a number n. Assume that the array contains...
Pease answer questions 4 and 5! Thank you so much! 4. Connect the 2nd resistor in parallel with the 1st resistor and connect that combination to the battery. Measure the following: The current passing through the R1, I1 = ___0.0058____ A The current passing through the R2, I2 = ___0.0031____ A The current supplied by the battery, I = ___0.0092____ A Calculate I1 + I2 = ____________ A Is the following statement true? I = I1 +...