#include <stdio.h>
#include <complex.h>
int main( ) {
double complex I_a, I_b, I_c, a2_Ib, a_Ic, I_neg;
// Input for I_a
printf ( "Enter I_a (real and imaginary part): " ) ; double I_a_real, I_a_imag;
scanf ( "%lf %lf" , & I_a_real
, & I_a_imag
) ; I_a = I_a_real + I_a_imag * i;
// Input for I_b
printf ( "Enter I_b (real and imaginary part): " ) ; double I_b_real, I_b_imag;
scanf ( "%lf %lf" , & I_b_real
, & I_b_imag
) ; I_b = I_b_real + I_b_imag * i;
// Input for I_c
printf ( "Enter I_c (real and imaginary part): " ) ; double I_c_real, I_c_imag;
scanf ( "%lf %lf" , & I_c_real
, & I_c_imag
) ; I_c = I_c_real + I_c_imag * i;
// Calculating a^2 * I_b
a2_Ib = - I_b / 2.0 + i * I_b;
// Calculating a * I_c
a_Ic = - I_c / 2.0 - i * I_c;
// Calculating Negative Sequence Current (I_neg)
I_neg = ( I_a + a2_Ib + a_Ic) / 3.0 ;
// Output the results
printf ( "Negative sequence current (I_neg): %.2f + %.2fi\n " , creal ( I_neg
) , cimag ( I_neg
) ) ; return 0 ;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxjb21wbGV4Lmg+CmludCBtYWluKCkgewpkb3VibGUgY29tcGxleCBJX2EsIElfYiwgSV9jLCBhMl9JYiwgYV9JYywgSV9uZWc7CmRvdWJsZSBpID0gc3FydCgtMSk7Ci8vIElucHV0IGZvciBJX2EKcHJpbnRmKCJFbnRlciBJX2EgKHJlYWwgYW5kIGltYWdpbmFyeSBwYXJ0KTogIik7CmRvdWJsZSBJX2FfcmVhbCwgSV9hX2ltYWc7CnNjYW5mKCIlbGYgJWxmIiwgJklfYV9yZWFsLCAmSV9hX2ltYWcpOwpJX2EgPSBJX2FfcmVhbCArIElfYV9pbWFnICogaTsKICAvLyBJbnB1dCBmb3IgSV9iCiAgICBwcmludGYoIkVudGVyIElfYiAocmVhbCBhbmQgaW1hZ2luYXJ5IHBhcnQpOiAiKTsKICAgIGR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