Monday, November 17, 2014

Find the Region

 

   Find the Region

 

#include<stdio.h>
#include<math.h>
main ()
{
 
    int X,Y,region;
    printf("   |   \n 2 | 1 \n   |   \n--- ---\n   |   \n 3 | 4 \n   |   \n");
    printf("\n\nEnter X,Y: ");
    scanf("%d%d",&X,&Y);
    if (X>0&&Y>0)
        region= 1;
    else if (X<0&&Y>0)
        region= 2;
    else if (X<0&&Y<0)
        region= 3;
    else
        region= 4;
    printf("\n\nThis point is in Region %d",region);
    printf("\n\n\n");
    return 0;
}

No comments:

Post a Comment