DEV Community

Durga Pokharel
Durga Pokharel

Posted on

Day 8 of 100DaysOfCode: Python Code to Find Out Composite Or Prime Number

This is my 8th day of #100daysofcode . Today I learned more about Cascading style sheets which tell the browser how to display the text and other content that we write in HTML. Also, I tired to write some code regarding to some mathematical problems. Below is my code of the day. Which is used to find composite or prime number.

def prime_or_composit(n):
    f = 0
    for i in range(1,int(n/2)+1):
        if n % i == 0:
            f += 1

    if f >= 2:
        print(f"{n} is composit.")
    else:
        print(f"{n} is prime.")
prime_or_composit(5)
Enter fullscreen mode Exit fullscreen mode

Day 8 of #100DaysOfCode and Python
* Basic CSS
* Python Function
* Code to find out composite or Prime from given number.#CodeNewbie , #beginner , #programming pic.twitter.com/gu1fee6267

— Durga Pokharel (@mathdurga) December 31, 2020

Top comments (0)