Q: write a program to receive cartesian coordinates and convert them in polar coordinate.


#include <stdio.h>
#include <math.h>

int main ()
{
    float x,y,r,A;
   
               printf("enter coordinate of point(x,y) :\n");
    scanf("%f%f",&x,&y);
   
    A = atan(y/x);    /*formula used to find inverse*/
    A = 180*A/3.14;    /*formula used to convert radian to degree*/
    r = sqrt(x*x + y*y);    /*formula used to find dist of point from orgin*/
   
    printf("polar cordinate for given point is (%f,%f)",r,A);
    return 0;
}
-----------------------------------------
output :

enter coordinate of point(x,y) :
4
5
polar cordinate for given point is (6.403124,51.366234)

Comments

Popular posts from this blog

Q: Two number are input through the keyboard into two two locations C and D. write a program to interchange the contents of C and D.

Q: Consider a currency system in which there are note of seven denominations, namely, Rs. 1, Rs. 2, Rs. 5, Rs. 10, Rs. 50, Rs. 100. if a sum of Rs. N is entered through the keyboard, write a program to compute the smallest number of notes that will combine to give Rs N.