Given three integers  'A' denoting the first term of an arithmetic sequence , 'C' denoting the common difference of an arithmetic sequence and an integer 'B'. you need to tell whether 'B' exists in the arithmetic sequence or not. Return 1 if B is present in the sequence. Otherwise, returns 0.
Example 1:
Input: A = 1, B = 3, C = 2
Output: 1
Explaination: 3 is the second term of the 
sequence starting with 1 and having a common 
difference 2.
Example 2:
Input: A = 1, B = 2, C = 3
Output: 0
Explaination: 2 is not present in the sequence.
Your Task:
You do not need to read input or print anything. Your task is to complete the function inSequence() which takes A, B and C and returns 1 if B is present in the sequence. Otherwise, returns 0.
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)
Constraints:
-10^{9} ≤ A, B, C ≤ 10^{9}

Difficulty: EASY
Tags: Mathematics
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)

Starter code:
#User function Template for python3



class Solution:

    def inSequence(self, A, B, C):

        # code here

Solutions:
class Solution:

	def inSequence(self, A, B, C):
		if C == 0:
			if B == A:
				return 1
			return 0
		else:
			if (B - A) % C == 0 and (B - A) / C >= 0:
				return 1
			return 0


import math

class Solution:

	def inSequence(self, a, b, c):
		if c == 0 and b == a:
			return 1
		elif c == 0 and b != a:
			return 0
		if (b - a) / c != (b - a) // c:
			return 0
		else:
			if c > 0 and b < a or (c < 0 and b > a):
				return 0
			return 1


class Solution:

	def inSequence(self, A, B, C):
		if C == 0:
			return 1 if A == B else 0
		n = (B + C - A) / C
		return 1 if n * 10 == int(n) * 10 and n > 0 else 0


class Solution:

	def inSequence(self, A, B, C):
		if B < A and C > 0:
			return 0
		if B > A and C < 0:
			return 0
		if C == 0:
			return int(A == B)
		return int((B - A) % C == 0)


class Solution:

	def inSequence(self, A, B, C):
		if C == 0:
			if A == B:
				return 1
			else:
				return 0
		z = (B - A) / C + 1
		if z <= 0:
			return 0
		else:
			z = z * 10
			if z % 10 == 0:
				return 1
			else:
				return 0


class Solution:

	def inSequence(self, A, B, C):
		d = B - A
		if d == 0:
			return 1
		if d < 0:
			if C >= 0:
				return 0
			if d % C == 0:
				return 1
			return 0
		if d > 0:
			if C <= 0:
				return 0
			if d % C == 0:
				return 1
			return 0


class Solution:

	def inSequence(self, A, B, C):
		d = B - A
		if d == C or d == 0:
			return 1
		elif d < 0:
			if C >= 0:
				return 0
			else:
				if d % C == 0:
					return 1
				return 0
		else:
			if C <= 0:
				return 0
			if d % C == 0:
				return 1
			return 0


class Solution:

	def inSequence(self, A, B, C):
		if A == B and C == 0:
			return 1
		if A > 0 and C > 0 and (B < 0):
			return 0
		if C != 0:
			i = (B - A) / C
			if i < 0:
				return 0
			if i.is_integer():
				return 1
		return 0


class Solution:

	def inSequence(self, A, B, C):
		if C == 0:
			if A == B:
				return 1
			else:
				return 0
		n = (B - A) / C
		m = int(n)
		if n > m or n < 0:
			return 0
		return 1


class Solution:

	def inSequence(self, A, B, C):
		if C != 0:
			n = (B - A) / C + 1
			m = (B - A) // C + 1
			if n > 0 and n == m:
				return 1
			else:
				return 0
		elif A == B:
			return 1
		else:
			return 0


class Solution:

	def inSequence(self, A, B, C):
		if B == A:
			return 1
		elif C == 0:
			return 0
		elif (B - A) / abs(B - A) != C / abs(C):
			return 0
		elif abs(B - A) % C == 0:
			return 1
		else:
			return 0


class Solution:

	def inSequence(self, a, b, c):
		if C == 0:
			if A == B:
				return 1
			else:
				return 0
		z = (B - A) / C + 1
		if z <= 0:
			return 0
		else:
			z = z * 10
			if z % 10 == 0:
				return 1
			else:
				return 0


import math

class Solution:

	def inSequence(self, A, B, C):
		if C == 0 and A == B:
			return 1
		if C == 0 and A != B:
			return 0
		n = (B - A) / C + 1
		if n >= 1 and math.floor(n) == math.ceil(n):
			return 1
		return 0