Skip to content

Instantly share code, notes, and snippets.

/zadatak Secret

Created October 3, 2016 18:51
Show Gist options
  • Save anonymous/ad3202315398473a487332133282f2d7 to your computer and use it in GitHub Desktop.
Save anonymous/ad3202315398473a487332133282f2d7 to your computer and use it in GitHub Desktop.
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main(){
int x1, x2, y1, y2;
printf("Unesi kordinate prve pa druge tacke (x1,y1 x2,y2)\n");
scanf_s("%d,%d %d,%d",&x1,&y1,&x2,&y2);
printf("Duz se nalazi u kvadrantu \n");
if (x1 > 0 && y1 > 0 && x2 > 0 && y2 > 0) { printf("1\n"); };
if (x1 < 0 && y1 > 0 && x2 < 0 && y2 > 0) { printf("2\n"); };
if (x1 < 0 && y1 < 0 && x2 < 0 && y2 < 0) { printf("3\n"); };
if (x1 > 0 && y1 < 0 && x2 > 0 && y2 < 0) { printf("4\n"); };
if ((x1 < 0 && y1 > 0 && x2 > 0 && y2 > 0) || (x1 > 0 && y1 > 0 && x2 < 0 && y2 > 0)) { printf("1 i 2\n"); };
if ((x1 < 0 && y1 > 0 && x2 < 0 && y2 < 0) || (x1 < 0 && y1 < 0 && x2 < 0 && y2 > 0)) { printf("2 i 3\n"); };
if ((x1 > 0 && y1 < 0 && x2 < 0 && y2 < 0) || (x1 < 0 && y1 < 0 && x2 > 0 && y2 < 0)) { printf("3 i 4\n"); };
if ((x1 > 0 && y1 < 0 && x2 > 0 && y2 > 0) || (x1 > 0 && y1 > 0 && x2 > 0 && y2 < 0)) { printf("4 i 1\n"); };
if ((x1 < 0 && y1 > 0 && x2 > 0 && y2 < 0 && y1 > x1 && x2 > y2) || (x1 > 0 && y1 < 0 && x2 < 0 && y2 > 0 && y2 < x2 && x1 < y1)) { printf("1 i 2 i 4\n"); };
if ((x1 < 0 && y1 > 0 && x2 > 0 && y2 < 0 && y1 < x1 && x2 < y2) || (x1 > 0 && y1 < 0 && x2 < 0 && y2 > 0 && y2 > x2 && x1 > y1)) { printf("1 i 3 i 4\n"); };
if ((x1 < 0 && y1 > 0 && x2 > 0 && y2 < 0 && y1 == x1 && x2 == y2) || (x1 > 0 && y1 < 0 && x2 < 0 && y2 > 0 && y2 == x2 && x1 == y1)) { printf("1 i 4\n"); };
if ((x1 > 0 && y1 > 0 && x2 < 0 && y2 < 0 && y1 > x1 && x2 < y2) || (x1 < 0 && y1 < 0 && x2 > 0 && y2 > 0 && y1 < x1 && x2 > y2)) { printf("1 i 4 i 3\n"); };
if ((x1 > 0 && y1 > 0 && x2 < 0 && y2 < 0 && y1 < x1 && x2 > y2) || (x1 < 0 && y1 < 0 && x2 > 0 && y2 > 0 && y1 > x1 && x2 < y2)) { printf("1 i 2 i 3\n"); };
if ((x1 > 0 && y1 > 0 && x2 < 0 && y2 < 0 && y1 == x1 && x2 == y2) || (x1 < 0 && y1 < 0 && x2 > 0 && y2 > 0 && y1 == x1 && x2 == y2)) { printf("1 i 3\n"); };
system("pause");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment