Ahmed
2013-04-08 15:05:48 UTC
#include
#include
int main()
{
char op;
float a,b,c,d,Vr,Vi;
printf("\nNUM.1 = a+bi\n\nNUM.2 = c+di\n\na = ");
scanf("%f",&a);
printf("\nb = ");
scanf("%f",&b);
printf("\nc = ");
scanf("%f",&c);
printf("\nd = ");
scanf("%f",&d);
printf("\n\nPlease enter the symbol of the operation >");
op = getchar();
switch(op)
{
case '+': printf("\n\nSummation = %f + %fi",a+c,b+d);
break;
case '-': printf("\n\nSubtraction = %f + %fi",a-c,b-d);
break;
case '*':
{
Vr = a*c + b*d;
Vi = b*c + a*d;
printf("\n\nMultiplication = %f + %fi",Vr,Vi);
}
break;
case '/':
{
Vr = (a*c - b*d)/(c*c + d*d);
Vi = (c*b - a*d)/(c*c + d*d);
printf("\n\nDivision = %f + %fi",Vr,Vi);
}
break;
};
}