Write the program to receive Cartesian coordinate (x,y) of a point and convert them into polar coordinates (r,c)

/* program to convert Cartesian co-ordinate (x,y)
into polar coordinates (r,c) */
#include<stdio.h>
#include<math.h>

int main()
{
    int x,y;
    float r,angle;
    printf("Enter the value of x and y:");
    scanf("%d%d",&x,&y);
    r=sqrt(pow(x,2)+ pow(y,2));
    angle=atan(y/x);
    angle=angle*180/3.14159265359;
    printf("The coordinate of r,c is (%f,%f)",r,angle);
    return 0;
}
Enter the value of x and y:1 1 The coordinate of r,c is (1.414214,45.000000)

 

Comments

Popular posts from this blog

5 d.) program to print this :