SHARE
TWEET

Untitled

a guest Sep 21st, 2019 96 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. typedef struct{
  5.     float x, y;
  6. }Ponto2d;
  7.  
  8. typedef struct{
  9.     Ponto2d c;
  10.     float r;
  11. }circunferencia;
  12.  
  13. int main(){
  14.     circunferencia circun;
  15.     Ponto2d p[10];
  16.     int n, i;
  17.     float dist;
  18.  
  19.     printf("ponto do centro: ");
  20.     scanf("%f %f", &circun.c.x, &circun.c.y);
  21.     printf("raio: ");
  22.     scanf("%f", &circun.r);
  23.  
  24.     printf("qtnd de P: ");
  25.     scanf("%d", &n);
  26.  
  27.     for(i=0; i<n; i++){
  28.         printf("ponto P: ");
  29.         scanf("%f %f", &p[i].x, &p[i].y);
  30.         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));
  31.         if( dist > circun.r )
  32.             printf("Pertence a circunferencia");
  33.         else if( dist <= circun.r )
  34.             printf("Nao pertence a circunferencia");
  35.     }
  36.  
  37.  
  38. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top