
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

    
struct complex_number {                           
   int real; 
   int imag; 
}; 

float magnitude (struct complex_number c1)  {
    
    return sqrt(c1.real*c1.real+c1.imag*c1.imag); 

}

int main()
{ 
   
   int i, n;
   
   printf("Enter the number of elements\n");
   scanf("%d", &n);
   
   
   struct complex_number array[n];
   
      
   for  (i=0; i<n; i++)  {
   
   printf("Enter the real and imaginary parts of the %d th complex number\n", i+1);     
   scanf("%d %d", &array[i].real, &array[i].imag);
   
   }
   
   struct complex_number *complex_Ptr;
   
   complex_Ptr = array;
   
   for  (i=0; i<n; i++, complex_Ptr++)  {
        
   printf("The magnitude of the number %d + %di = %.3f\n", complex_Ptr->real, complex_Ptr->imag, magnitude(*complex_Ptr));
   
   }
   
 
system("pause");

return 0; 

}


