Advertisement
cd62131

-lm

Dec 30th, 2018
524
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.33 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <tgmath.h>
  3. typedef double complex point_t;
  4. static inline double sq_norm(point_t p) { return p * conj(p); }
  5. int main(void) {
  6.   printf("Keyin x and y values >> ");
  7.   fflush(stdout);
  8.   double x, y;
  9.   if (scanf("%lf%lf", &x, &y) == 2) {
  10.     point_t p = CMPLX(x, y);
  11.     printf("%.1f\n", sq_norm(p));
  12.   }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement