DEV Community

Durga Pokharel
Durga Pokharel

Posted on

1 1

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]))
Enter fullscreen mode Exit fullscreen mode

Output of the code is,

999999
6
Enter fullscreen mode Exit fullscreen mode

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))
Enter fullscreen mode Exit fullscreen mode

When above code run we can get

18 35
1
Enter fullscreen mode Exit fullscreen mode

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

Heroku

Deliver your unique apps, your own way.

Heroku tackles the toil — patching and upgrading, 24/7 ops and security, build systems, failovers, and more. Stay focused on building great data-driven applications.

Learn More

Top comments (0)

Jetbrains image

Build Secure, Ship Fast

Discover best practices to secure CI/CD without slowing down your pipeline.

Read more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay