Problem 58

6 comments on “Problem 58”


  • shushank

    #Python

    n=int(input())
    while n>0:
    a,b,c=map(int,input().split(” “))
    x=abs(a-c)
    y=abs(b-c)
    if x>y:
    print(“Cat B”)
    elif x<y:
    print("cat A")
    else:
    print("Mouse C")
    n-=1


  • Mihir

    Python Code
    x=int(input(‘Postion of Cat A ‘))
    y=int(input(‘Postion of Cat B ‘))
    z=int(input(‘Postion of Mouse ‘))

    if abs(y-z) > abs(x-z):
    print(‘Cat A ‘)
    elif abs(y-z) < abs(x-z):
    print('Cat B ')
    else :
    print('Mouse Escapes ')


  • Sriram

    #include
    #include
    #include
    void catandmouse(int x,int y,int z)
    {
    x=abs(z-x);
    y=abs(z-y);
    if(x<y)
    printf("\nCAT A");
    else if(y<x)
    printf("\nCAT B");
    else
    printf("\nMouse C Escapes");
    }
    int main()
    {
    int x=0,y=0,z=0,q=2;
    while(q)
    {
    printf("\nEnter the values of x,y and z\n");
    scanf("%d%d%d", &x,&y,&z);
    catandmouse(x,y,z);
    q–;
    }
    return 0;

    }


  • Shreyash

    #include
    using namespace std;
    int catandmouse(int x,int y,int z){
    x = (z-x);
    y = (z-y);
    if(x>y){
    cout<<"CAT B"<x){
    cout<<"CAT A"<<endl;
    }
    else{
    cout<<"MOUSE C"<>q;
    while(q–){
    int x,y,z;
    cin>>x>>y>>z;
    catandmouse(x,y,z);
    }
    return 0;
    }


      • sneha

        #include
        #include
        int main()
        {
        int n,a[10],x,y,z;
        scanf(“%d”,&n);
        while(n)
        {
        for(int i=0;iy)
        {
        printf(“cat B”);
        }
        else
        {
        printf(“cat A”);
        }
        –n;
        }

        return 0;
        }