Question: 1. Create a script with if, else if, and else conditionals to calculate the Total Resistance (R_T) 1) r1 , r2, and r3 are connected
1. Create a script with if, else if, and else conditionals to calculate the Total Resistance (R_T) 1) r1 , r2, and r3 are connected in series manner. (R_T= r1+r2+r3) 2) r1, r2, and r3 are connected in parallel manner.(R_T = 1/((1/r1)+(1/r2)+(1/r3)) ) 3) r1 is connected to the parallelly connected r2 and r3 in series manner.
(R_T = r1 + r2xr3/(r2+r3) ) The output should be
The Total Resistance is [your result] ohms since r1, r2, r3 are connected in [series, parallel, combination] manner. r1 = 10 , r2 = 20 , and r3 = 30 .
2. Repeat problem 1. This time use switch.
3. Create a script that will add all integers between 1 (initial) and 100 (final). Also, create another script that will do the same operation,bBut this time use decrement operator so can have 100 for the initial integer and 1 for the final integer.
4. Lets create our own quadratic equation solver.
a) First, try using loop with changing numbers x from 0 to 10. (This is just the completion of the work that we tried in class.) (I.E: Create script with loops that will find values of xs that will satisfy the equality ax^2+bx+c=0) Try with a = 1, b=-4, and c =3 and a =1, b=-4 and c = 4. (Lets stick to integer roots)
b) Second, we can try [b (+/-) sqrt(b^2-4ac)] / (2a), but this requires a lot of conditions (please pardon the pun.), since we can have three different forms of outcome.
float a, b, c; float REAL1, IMAG1, IMAG2; a=1.0; b=4.0; c= 3.0;
// a=1.0; b=4.0; c= 5.0 ;// a=1.0; b=4.0; c= 4.0 (Try with these 3 sets of a, b, c) REAL1=-b/2;
IMAG1=b*b-4*a*c; IMAG2=4*a*c-b*b;
(USING DEV C++)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
