IDNStudy.com, ang iyong destinasyon para sa mabilis at eksaktong mga sagot. Magtanong at makatanggap ng maaasahang sagot mula sa aming dedikadong komunidad ng mga eksperto.

Structures


The circle has two data members, a Point representing the center of the circle and a float value representing the radius as shown below.


typedef struct{


Point center;


float radius;


}Circle;


Implement the following functions:


a. float diameter(Circle circ); //computes the diameter of a circle.


b. float area(Circle circ); //computes for area of a circle


c. float circumference(Circle circ);//computes for the circumference of a circle.

C programming


Sagot :

Answer:#include <stdio.h>

int main() {

  int radius;

  float area, perimeter;    

  radius = 6;

  perimeter = 2*3.14*radius;

  printf("Perimeter of the Circle = %f inches\n", perimeter);

area = 3.14*radius*radius;

printf("Area of the Circle = %f square inches\n", area);

return(0);

}

struct circle {

float x;      // center x

float y;      // center y

float radius;  

};

int

point_inside (struct circle *c, float x, float y)

{

float x2 = (x - c->x) * (x - c->x);

float y2 = (y - c->y) * (y - c->y);

float r2 = c->radius * c->radius;

// if squared distance is less than squared radius

// point is inside the circle

return (x2 + y2 < r2);

}

Explanation: still finding answers for this huhuhuhu