## DEV Community is a community of 879,630 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

# Day 53 Of 100DaysOfCode: More About Algorithm

Greetings everybody. I hope you all are great. Today I started to learn SQL from Data camp. Gain more knowledge about Algorithms. Tried to write some algorithm. Completed some assignment on coursera.

Below is my some algorithm today I tried to write myself.

# Python code

python code to find Last Digit of a Large Fibonacci Number.

``````def calc_fib(n):
a = 0
b = 1
fib = [a,b]
if n <= 0:
return n

else:
for i in range(1,n):
f = a + b
a = b
b = f
return b

n = int(input())
print(int(str(calc_fib(n))[-1]))
``````

Output of the code is,

``````999999
6
``````

Python code to compute gcd of two number

``````def gcd(a,b):
m1 = min(a,b)
m2 = max(a,b)
CF = []
for i in range(1,m1+1):
if m1 % i == 0 and m2 % i == 0:
CF.append(i)
return max(CF)

a, b = map(int, input().split())
print(gcd(a,b))
``````

When above code run we can get

``````18 35
1
``````