Durga Pokharel

Posted on

# 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
``````

Day 53 Of #100DaysOfCode and #Python
Hello! everyone. I hope you all guys doing well. Today I return to my 100daysofcode after taking 3 days of brake.
Today's achievement is,
* Learned SQL From Data Camp
* Continue to learned Algorithmic Toolbox
* Tried to write some Algorithms pic.twitter.com/8TX3x5PLkb

— Durga Pokharel (@mathdurga) February 19, 2021