Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- typedef struct{
- float x, y;
- }Ponto2d;
- typedef struct{
- Ponto2d c;
- float r;
- }circunferencia;
- int main(){
- circunferencia circun;
- Ponto2d p[10];
- int n, i;
- float dist;
- printf("ponto do centro: ");
- scanf("%f %f", &circun.c.x, &circun.c.y);
- printf("raio: ");
- scanf("%f", &circun.r);
- printf("qtnd de P: ");
- scanf("%d", &n);
- for(i=0; i<n; i++){
- printf("ponto P: ");
- scanf("%f %f", &p[i].x, &p[i].y);
- dist = sqrt((p[i].x - circun.c.x)*(p[i].x - circun.c.x) + (p[i].y - circun.c.y)*(p[i].y - circun.c.y));
- if( dist > circun.r )
- printf("Pertence a circunferencia");
- else if( dist <= circun.r )
- printf("Nao pertence a circunferencia");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement