Skip to content

Commit

Permalink
IP assignments
Browse files Browse the repository at this point in the history
  • Loading branch information
linrakesh committed Dec 23, 2019
1 parent 60cbca9 commit fba6888
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Loops/emi_calculator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# program to find out EMI using formula
# EMI = (p*r(1+r)**t)/((1+r)**t-1)
# made by : rakesh kumar

from math import pow


def emi_calculate(p, r, t):
r = r/(12*100) # rate for one month
t = t*12 # one month time
emi = (p*r*pow(1+r, t))/(pow(1+r, t)-1)
return emi


if __name__ == "__main__":
p = int(input('Enter pricipal amount :'))
r = int(input('Enter rate of interest :'))
t = int(input('Enter time in years :'))
emi = emi_calculate(p, r, t)

print('Monthly Installment :%.2f' % emi)
22 changes: 22 additions & 0 deletions Loops/gcd_two.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# program to find out GCD of two number using iterative method
# made by : rakeseh kumar


a = int(input('Enter any number'))
b = int(input('Enter another number'))

""" if(a > b):
number = a
divider = b
else:
number = b
divider = a """

rem = a % b

while(rem != 0):
a = b
b = rem
rem = a % b

print('Your GCD is :', b)
2 changes: 2 additions & 0 deletions Loops/tempCodeRunnerFile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

r = int(input('Enter rate of interest amount :'))
12 changes: 12 additions & 0 deletions functions/recursion/gcd_recursion.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
def gcd(a, b):
if(b == 0):
return a
else:
return gcd(b, a % b)


if __name__ == "__main__":
a = int(input('Enter first number '))
b = int(input('Enter second number '))
result = gcd(a, b)
print('GCD of {} and {} is {}'.format(a, b, result))

0 comments on commit fba6888

Please sign in to comment.