MxPhenom 216
ASIC Engineer
- Joined
- Aug 31, 2010
- Messages
- 13,188 (2.43/day)
- Location
- Loveland, CO
System Name | Main Stack |
---|---|
Processor | AMD Ryzen 7 9800X3D |
Motherboard | Asus X870 ROG Strix-A - White |
Cooling | Air (temporary until 9070xt blocks are available) |
Memory | G. Skill Royal 2x24GB 6000Mhz C26 |
Video Card(s) | Powercolor Red Devil Radeon 9070XT 16G |
Storage | Samsung 9100 Gen5 1TB | Samsung 980 Pro 1TB (Games_1) | Lexar NM790 2TB (Games_2) |
Display(s) | Asus XG27ACDNG 360Hz QD-OLED | Gigabyte M27Q-P 165Hz 1440P IPS | LG 24" 1440 IPS 1440p |
Case | HAVN HS420 - White |
Audio Device(s) | FiiO K7 | Sennheiser HD650 + Beyerdynamic FOX Mic |
Power Supply | Corsair RM1000x ATX 3.1 |
Mouse | Razer Viper v3 Pro |
Keyboard | Corsair K65 Plus 75% Wireless - USB Mode |
Software | Windows 11 Pro 64-Bit |
I am working on an assignment for my programming class in Visual studio and one part is to do this equation.
Equivalent parallel resistance: parallel_resistance = 1 / (1 / R1 + 1 / R2 + 1 / R3), for 3 resistors. R1, R2, and R3 are integers.
I have it setup as follows
.
.
.
.
.
.
And it crashes right after I give the value for R3. If I do debug, it says something about division by zero.
Read that this has to do with integer division if the denominator ends up being 0 it will fail, but if you are doing floating point division it will work even if its 0.0.
IM confused, Cant get it working, and R1 R2 and R3 have to be ints.
Equivalent parallel resistance: parallel_resistance = 1 / (1 / R1 + 1 / R2 + 1 / R3), for 3 resistors. R1, R2, and R3 are integers.
I have it setup as follows
.
.
.
.
.
.
printf ("Enter an integer value for R1: ");
scanf ("%d", &R1);
printf ("Enter an integer value for R2: ");
scanf ("%d", &R2);
printf ("Enter an integer value for R3: ");
scanf ("%d", &R3);
parallel_resistance = 1 / (1 / R1 + 1 / R2 + 1 / R3);
printf ("Parallel Resistance for 3 given resistors: 1 / (1 / %d + 1 / %d + 1 / %d) = %lf", R1, R2, R3, parallel_resistance );
And it crashes right after I give the value for R3. If I do debug, it says something about division by zero.
Read that this has to do with integer division if the denominator ends up being 0 it will fail, but if you are doing floating point division it will work even if its 0.0.
IM confused, Cant get it working, and R1 R2 and R3 have to be ints.