bsc

Comprehensive codebase and cou...
Log | Files | Refs | Activity | README | LICENSE

root / semester_1 / letusc / luc005.c

luc005.c (544B)


      1 /* Write a program to recive Cartesian
      2 co-ordinates (x, y) of a point and convert
      3 them into Polar co-ordinates (r, phi)
      4     Hint : r = sqrt (x^2 + y^2) and phi = tan^-1 (y/x) */
      5 /* Let Us C; Page - 37; Chap- 2; QNo.: G(b) */
      6 
      7 #include <stdio.h>
      8 #include <math.h>
      9 int main()
     10 {
     11     double x, y, r, phi;
     12     printf("Enter the Cartesian Co-Ordinates in this format 'x, y' : ");
     13     scanf("%lf, %lf", &x, &y);
     14     r = sqrt(pow(x, 2) + pow(y, 2));
     15     phi = atan2(y, x);
     16     printf("\nPolar Co-Ordinates are : (%g, %g Rad)", r, phi);
     17     return 0;
     18 }
© notamitgamer • Site Built: 2026-09-05 01:53:16 UTC • git-mirror commit: c170d72 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror