#include <stdio.h>
#include <stdlib.h>
#include <math.h>
typedef struct COMPLEX_T
{
int real;
int imaginary;
} complex_t;
else if (choice == 3) {
printf("\n\nEnter a and b where a + ib is a complex number\n");
printf("a = ");
scanf("%d", &a.real);
printf("b = ");
scanf("%d", &a.imaginary);
float sqr_sum = pow(a.real, 2) + pow(a.imaginary, 2);
float abs = pow(sqr_sum, 1/2);
printf("\n\nThe absolute value is: %.2f", abs);
}
Here is a code snippet. I am trying to find the absolute value of a complex number. When I input two numbers the output is "1.00", no matter which two numbers I input.
Any suggestions?