Code:#include <stdio.h> #include <math.h> main() { double first_a, first_b, second_a, second_b, ans1, ans2, ans3, ans4, ans5, ans6; printf("Test Complex Number Arithmetic"); printf("\n"); printf("Enter the first complex number in the form - real, imaginary - --> ("); scanf(" ( %lf , %lf )", &first_a, &first_b ); printf("\n"); printf("Enter the second complex number in the form - real, imaginary - --> ("); scanf(" ( %lf , %lf )", &second_a, &second_b ); printf("\n"); ans1 = (first_a + second_a, first_b + second_b); ans2 = (first_a - second_a, first_b - second_b); ans3 = (first_a * second_a, first_b * second_b); ans4 = (first_a / second_a, first_b / second_b); ans5 = (sqrt(first_a), sqrt(first_b)); ans6 = (sqrt(second_a), sqrt(second_b)); printf("Results: (%lf) + (%lf) = (%lf) (%lf) + (%lf) = (%lf) (%lf) + (%lf) = (%lf) abs(%lf) + (%lf) = (%lf) abs(%lf) + (%i) = (%i)", first_a, first_b, second_a, second_b, ans1, first_a, first_b, second_a, second_b, ans2, first_a, first_b, second_a, second_b, ans2, first_a, first_b, second_a, second_b, ans3, first_a,$ return 0; }



LinkBack URL
About LinkBacks


