MxPhenom 216
ASIC Engineer
- Joined
- Aug 31, 2010
- Messages
- 13,062 (2.48/day)
- Location
- Loveland, CO
System Name | Ryzen Reflection |
---|---|
Processor | AMD Ryzen 9 5900x |
Motherboard | Gigabyte X570S Aorus Master |
Cooling | 2x EK PE360 | TechN AM4 AMD Block Black | EK Quantum Vector Trinity GPU Nickel + Plexi |
Memory | Teamgroup T-Force Xtreem 2x16GB B-Die 3600 @ 14-14-14-28-42-288-2T 1.45v |
Video Card(s) | Zotac AMP HoloBlack RTX 3080Ti 12G | 950mV 1950Mhz |
Storage | WD SN850 500GB (OS) | Samsung 980 Pro 1TB (Games_1) | Samsung 970 Evo 1TB (Games_2) |
Display(s) | Asus XG27AQM 240Hz G-Sync Fast-IPS | Gigabyte M27Q-P 165Hz 1440P IPS | LG 24" IPS 1440p |
Case | Lian Li PC-011D XL | Custom cables by Cablemodz |
Audio Device(s) | FiiO K7 | Sennheiser HD650 + Beyerdynamic FOX Mic |
Power Supply | Seasonic Prime Ultra Platinum 850 |
Mouse | Razer Viper v2 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.