Calculate the amount for given principal amount P , time T(in years), compounded N times in a year at rate R. Calculate floor of future value of given principal amount.
 
Example 1: 
Input:
P = 1000 , T = 2 , N = 2 , R = 10
Output:
1215
Explanation:
The given Principal, Time, Rate and
number of compounds in a year results
in a amount of 1215.51.
The floor value being 1215, Output is 1215.
Example 2: 
Input:
P = 100 , T = 1 , N = 1 , R = 10
Output:
110
Explanation:
The given Principal, Time, Rate and
number of compounds in a year results
in a amount of 110.
So, the Output is 110.
 
Your Task:
You don't need to read input or print anything. Your task is to complete the function getCompundInterest() which takes Integers P,T,N and R as input respectively and returns the answer.
 
Expected Time Complexity: O(log(N*T))
Expected Auxiliary Space: O(1)
 
Constraints:
1 <= P <= 1000
1 <= T <= 20
1 <= N <= 4
1 <= R <= 20

Source: geeksforgeeks | Difficulty: EASY
Tags: Mathematics

Starter code: #User function Template for python3



class Solution:

    def getCompundInterest(self, P ,T , N , R):

        # code here

Solutions:
import math

class Solution:

	def getCompundInterest(self, P, T, N, R):
		return math.floor(P * math.pow(1 + R / 100 / N, N * T))


class Solution:

	def getCompundInterest(self, P, T, N, R):
		a = P * (1 + R / (N * 100)) ** (N * T)
		return int(a)


class Solution:

	def getCompundInterest(self, P, T, N, R):
		amt = int(P * math.pow(1 + R / 100 / N, N * T))
		return amt


class Solution:

	def getCompundInterest(self, P, T, N, R):
		b = pow(1 + R / 100 / N, N * T)
		return int(P * b)


class Solution:

	def getCompundInterest(self, P, T, N, R):
		ci = int(P * (1 + R / 100.0 / N) ** (N * T))
		return ci


import math

class Solution:

	def getCompundInterest(self, P, T, N, R):
		power = N * T
		brac = 1 + R / (100 * N)
		amount = P * brac ** power
		return math.floor(amount)


class Solution:

	def getCompundInterest(self, P, T, N, R):
		A = P * pow(1 + R / 100.0 / N, N * T)
		return int(A)


class Solution:

	def getCompundInterest(self, P, T, N, R):
		nt = N * T
		result = P * pow(1 + R / 100 / N, nt)
		return int(result)


class Solution:

	def getCompundInterest(self, P, T, N, R):
		A = P * (1 + R / (N * 100)) ** (T * N)
		Ci = A - P
		return int(A)


class Solution:

	def getCompundInterest(self, P, T, N, R):
		a = P * (1 + R / (N * 100)) ** (N * T)
		return math.floor(a)


import math

class Solution:

	def getCompundInterest(self, P, T, N, R):
		return int(P * pow(1 + R / 100.0 / N, N * T))


class Solution:

	def getCompundInterest(self, P, T, N, R):
		for i in range(T * N):
			P += R / (N * 100) * P
		return int(P)


class Solution:

	def getCompundInterest(self, P, T, N, R):
		import math
		t = T * N
		r = N * 100
		Amt = P * (1 + R / r) ** t
		return math.floor(Amt)


class Solution:

	def getCompundInterest(self, p, t, n, r):
		return int(p * pow(1 + r / 100 / n, n * t))


import math

class Solution:

	def getCompundInterest(self, P, T, N, R):
		for _ in range(T):
			for _ in range(N):
				P += P * R / N / 100
		return math.floor(P)


class Solution:

	def getCompundInterest(self, P, T, N, R):
		r = R / 100 / N
		cp = P * (1 + r) ** (N * T)
		cp = int(cp)
		return cp


class Solution:

	def getCompundInterest(self, P, T, N, R):
		A = P * pow(1 + 0.01 * R / N, N * T)
		return math.floor(A)