DEV/DEV1.1/TP11/complexes.c

32 lines
534 B
C
Raw Normal View History

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
struct complexe{
double x;
double y;
};
int module(struct complexe cp){
return sqrt(pow(cp.x,2)+pow(cp.y,2));
}
void inverse(struct complexe cp){
printf("%d + I * %d\n",cp.x/pow(module(cp),2),cp.y/pow(module(cp),2));
}
void conjugue(struct complexe cp){
printf("%d - %d * I\n", cp.x, cp.y);
}
int main(int argc, char const *argv[])
{
struct complexe lol={2.785,5.233};
double lolol=module(lol);
printf("%d \n",lolol);
conjugue(lol);
inverse(lol);
return 0;
}