Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- #include "winbgi2.h"
- #include <time.h>
- #include <stdlib.h>
- int ktora_cwiartka( double x, double y)
- { if( x > 0 && y > 0) { printf("pierwsza cwiartka\n"); }
- else if( x < 0&& y > 0) { printf("druga cwiartka\n"); }
- else if( x < 0&& y < 0) { printf("trzecia cwiartka\n"); }
- if( x > 0&& y < 0) { printf("czwarta cwiartka\n"); }
- if( x == 0|| y == 0) { printf(" lezy na osi wspolrzednych\n"); }
- return 0;
- }
- int main()
- {
- double x, y;
- int n;
- printf("podaj ilosc losowan wspolrzednych: ");
- scanf("%d", &n);
- printf("\n");
- srand( time(NULL));
- for( int i = 0; n> i; i++)
- {
- x = rand()%11-5;
- y = rand()%11-5;
- printf("x = %.1lf, y = %.1lf\t", x, y);
- printf("%d\n", ktora_cwiartka( x, y));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement