3
How to represent a complex number z = x + yi?
3
How to represent a complex number z = x + yi?
7
It would be by including complex.h
:
#include <stdio.h>
#include <complex.h>
int main() {
double x = 1.0;
double y = 2.0;
double complex z = x + y * I;
printf("%.2f %+.2fi\n", creal(z), cimag(z));
}
Behold working in the ideone. And in the repl it.. Also put on the Github for future reference.
Browser other questions tagged c mathematics
You are not signed in. Login or sign up in order to post.