Contact
Privacy
Coding Development Art
  • Home
  • Latest
  • Oldest
  • Popular
  • Random
  • Home»
  • Categrories»
  • Programming Languages»
  • Python»

Write a program to check whether a number is prime or not - Python

Categories:
Python
Viewed: 4 - Published at: a few seconds ago

[ Write a program to check whether a number is prime or not ]

num = 337

if num > 1:
   for i in range(2, num//2 + 1):
       if (num % i) == 0:
           print(num,"is not a prime number")
           print(f"{i} times {num//i} is {num}")
           break
   else:
       print(f"{num} is a prime number")

else:
   print(f"{num} is not a prime number")

Related Posts:

Validation and exception vs. error message tuple
Validation and exception vs. error message tuple
Python
express unit testing, calling close on server results in `call of undefined`
express unit testing, calling close on server results in `call of undefined`
JavaScript
How to let Python code continue after telnet (telnetlib) timeout
How to let Python code continue after telnet (telnetlib) timeout
Python
Reading several arrays in a binary file with numpy
Reading several arrays in a binary file with numpy
Python
Python for NLP: Neural Machine Translation with Seq2Seq in Keras
Python for NLP: Neural Machine Translation with Seq2Seq in Keras
Python
Structure in C – Part 3
Structure in C – Part 3
C Programs

You may also like:

Graphs in Java - A* Algorithm
Graphs in Java - A* Algorithm
Algorithm
How can I get a list of tables connected to each module in AX 09?
How can I get a list of tables connected to each module in AX 09?
Can I bin deploy and MVC4 for .NET 4 where I have an MVC3 app running?
Can I bin deploy and MVC4 for .NET 4 where I have an MVC3 app running?
How can I get jcifs to play nicely with apache axis
How can I get jcifs to play nicely with apache axis
Java
having difficulty with xml writing
having difficulty with xml writing
Android
FPDF multicell alignment not working
FPDF multicell alignment not working
PHP
Categories
  • Blog
    • Career
    • Computer
    • Downloads
    • Internet
    • Linux
    • News
    • Review
    • Security
    • Technology
  • Database
    • MySql
    • Oracle Database
    • SQL Server
    • SQLite
    • mongodb
  • Dev
    • Algorithm
    • Android
    • Batch File Programming
    • Books
    • Competitive Programming
    • Computer Networks
    • Data Structure
    • Design
    • Development
    • Flutter
    • Game
    • Git
    • Interview Questions
    • JDBC
    • Machine Learning
    • Mobile
    • Operating System
    • Programming
    • Projects
    • Sponsored
    • Webservice
    • iOS
  • Framework
    • .NET
    • Angular
    • Django
    • MVC
    • Nodejs
    • React
  • Programming Languages
    • ASP.NET
    • C Programs
    • C#
    • C++ Programs
    • CSS
    • HTML
    • JSP
    • Java
    • JavaScript
    • PHP
    • PL/SQL
    • Python
    • SQL
    • Swift
    • VB.NET
  • Tools
    • privacy-policy-generator
    • Mac Vendors
    • Ports Numbers
    • Wifi Routers Passwords

Site all the data, are collected from Internet, belongs to original author, please do not used for commercial purposes !

Coding Development Art
  https://www.codevelop.art
 
  contact@codevelop.art

Posts

  • Home
  • Latest
  • Oldest
  • Popular
  • Random

Follow Us

© 2018 codevelop.art - Coding Develop Art - programming and development tutorials blog - Learn all Program languages | codevelop.art.
All Rights Reserved.
  • Contact
  • Privacy
  • Terms of service
  • Copyright
  • Disclaimer