#include<stdio.h>
#include<conio.h>
#include<math.h>
#define PI 3.141592
int main()
{
float x, y, r, theta;
clrscr();
printf("Enter radius of polar coordinate (r): ");
scanf("%f", &r);
printf("Enter angle of polar coordinate in degree (theta): ");
scanf("%f", &theta);
theta = theta * PI/180.0;
x = r * cos(theta);
y = r * sin(theta);
printf("Cartesian coordinates is: (%0.3f, %0.3f)", x, y);
getch();
return(0);
}
Output
Enter radius of polar coordinate (r): 1.4142 ↲
Enter angle of polar coordinate in degree (theta): 45 ↲
Cartesian coordinates is: (1.000, 1.000)