an easy approach:
x1 = int(input(“Enter the starting position of kangaroo1:”))
v1 = int(input(“Enter the speed of kangaroo1:”))
x2 = int(input(“Enter the starting position of kangaroo1:”))
v2 = int(input(“Enter the speed of kangaroo2:”))
x = []
sum1 = x1 + v1
sum2 = x2 + v2
x.append(sum1)
print(“The kangaroo1 is at {} “.format(sum1))
x.append(sum2)
print(“The kangaroo2 is at {} “.format(sum2))
if sum1==sum2:
print(“Yess!!; They kangaroos will meet at {} which is the same location”.format(sum2))
else:
print(“No the kangaroos with not meet at the same distance given the speeds”)
x1=int(input())
v1=int(input())
x2=int(input())
v2=int(input())
if(x1+v1==x2+v2):
print(“yes”)
else:
print(“no”)
python:
def kangaroo(x1, v1, x2, v2):
if (x1<x2 and v1<v2):
print ('NO')
for i in range(0,10000):
x1 = x1 + v1
x2 = x2 + v2
if (x1==x2):
print ('YES')
break
if (x1 != x2):
print ('NO')
x1,v1,x2,v2 = map(int,input().split())
kangaroo(x1, v1, x2, v2)
#Pyhton Programming
x1,v1,x2,v2=map(int,input().split(” “))
if x1+v1==x2+v2:
print(“Yes”)
else:
print(“No”)
an easy approach:
x1 = int(input(“Enter the starting position of kangaroo1:”))
v1 = int(input(“Enter the speed of kangaroo1:”))
x2 = int(input(“Enter the starting position of kangaroo1:”))
v2 = int(input(“Enter the speed of kangaroo2:”))
x = []
sum1 = x1 + v1
sum2 = x2 + v2
x.append(sum1)
print(“The kangaroo1 is at {} “.format(sum1))
x.append(sum2)
print(“The kangaroo2 is at {} “.format(sum2))
if sum1==sum2:
print(“Yess!!; They kangaroos will meet at {} which is the same location”.format(sum2))
else:
print(“No the kangaroos with not meet at the same distance given the speeds”)
x1,v1,x2,v2 =map(int,input().split())
sum1=x1+v1
sum2=x2+v2
if sum1>sum2 or sum1<sum2:
print('no')
else:
print('yes')
#include
int main()
{
int x1,x2,v1,v2;
printf(“enter location and velocity of kangaroo 1\n”);
scanf(“%d%d”,&x1,&v1);
printf(“enter location and velocity of kangaroo 2\n”);
scanf(“%d%d”,&x2,&v2);
if(x1v2)
printf(“YES”);
else
printf(“NO”);
}
else
{
if(v2>v1)
printf(“YES”);
else
printf(“NO”);
}
}