Tuklasin ang maliwanag na mga sagot sa iyong mga tanong sa IDNStudy.com. Magtanong at makakuha ng detalyadong sagot mula sa aming komunidad ng mga eksperto na may kaalaman.

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

Natutuwa kami na ikaw ay bahagi ng aming komunidad. Magpatuloy sa pagtatanong at pagbibigay ng mga sagot. Sama-sama tayong lumikha ng isang mas matibay na samahan. Para sa mabilis at maasahang mga sagot, bisitahin ang IDNStudy.com. Nandito kami upang tumulong sa iyo.