Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. #include "winbgi2.h"
  4. #include <time.h>
  5. #include <stdlib.h>
  6.  
  7. int ktora_cwiartka( double x, double y)
  8. { if( x > 0 && y > 0) { printf("pierwsza cwiartka\n"); }
  9. else if( x < 0&& y > 0) { printf("druga cwiartka\n"); }
  10. else if( x < 0&& y < 0) { printf("trzecia cwiartka\n"); }
  11. if( x > 0&& y < 0) { printf("czwarta cwiartka\n"); }
  12. if( x == 0|| y == 0) { printf(" lezy na osi wspolrzednych\n"); }
  13. return 0;
  14.  
  15. }
  16.  
  17.  
  18. int main()
  19. {
  20. double x, y;
  21. int n;
  22. printf("podaj ilosc losowan wspolrzednych: ");
  23. scanf("%d", &n);
  24. printf("\n");
  25.  
  26. srand( time(NULL));
  27.  
  28.  
  29. for( int i = 0; n> i; i++)
  30. {
  31. x = rand()%11-5;
  32. y = rand()%11-5;
  33.  
  34.  
  35. printf("x = %.1lf, y = %.1lf\t", x, y);
  36.  
  37.  
  38. printf("%d\n", ktora_cwiartka( x, y));
  39.  
  40. }
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement