47 lines
1011 B
C
47 lines
1011 B
C
|
#include <math.h>
|
||
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
struct complexe{
|
||
|
double reel;
|
||
|
double imag;
|
||
|
};
|
||
|
|
||
|
typedef struct complexe complexe;
|
||
|
|
||
|
void afficheComplexe(double x , double y){
|
||
|
printf("La notation algebrique de ce nombre complexe est : %lf+%lfi\n",x,y);
|
||
|
}
|
||
|
|
||
|
double calcModule(complexe C){
|
||
|
double module;
|
||
|
module = pow (C.reel,2)+ pow (C.imag,2);
|
||
|
module = pow (module,0.5);
|
||
|
return module;
|
||
|
}
|
||
|
|
||
|
complexe calcConjugue(complexe C){
|
||
|
complexe res;
|
||
|
res.reel=C.reel;
|
||
|
res.imag=-C.imag;
|
||
|
return res;
|
||
|
}
|
||
|
|
||
|
complexe calcInverse(complexe C){
|
||
|
complexe res;
|
||
|
res.reel=C.reel/pow(calcModule(C),2);
|
||
|
res.imag=C.imag/pow(calcModule(C),2);
|
||
|
return res;
|
||
|
}
|
||
|
|
||
|
int main() {
|
||
|
complexe C = {6,10};
|
||
|
afficheComplexe(C.reel , C.imag);
|
||
|
double moduleDeC=(calcModule(C));
|
||
|
printf("Le module de ce complexe est : %lf\n",moduleDeC);
|
||
|
complexe conjugueDeC = calcConjugue(C);
|
||
|
afficheComplexe(conjugueDeC.reel , conjugueDeC.imag);
|
||
|
complexe inverseDeC = calcInverse(C);
|
||
|
afficheComplexe(inverseDeC.reel , inverseDeC.imag);
|
||
|
return 0;
|
||
|
}
|