luc005.c (680B)
1 /* 2 * Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 12 Dec 2025 3 * Repo: https://github.com/notamitgamer/bsc 4 * License: MIT 5 */ 6 7 /* Write a program to recive Cartesian 8 co-ordinates (x, y) of a point and convert 9 them into Polar co-ordinates (r, phi) 10 Hint : r = sqrt (x^2 + y^2) and phi = tan^-1 (y/x) */ 11 /* Let Us C; Page - 37; Chap- 2; QNo.: G(b) */ 12 13 #include <stdio.h> 14 #include <math.h> 15 int main() 16 { 17 double x, y, r, phi; 18 printf("Enter the Cartesian Co-Ordinates in this format 'x, y' : "); 19 scanf("%lf, %lf", &x, &y); 20 r = sqrt(pow(x, 2) + pow(y, 2)); 21 phi = atan2(y, x); 22 printf("\nPolar Co-Ordinates are : (%g, %g Rad)", r, phi); 23 return 0; 24 }