SHARE
TWEET

Untitled

a guest May 24th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #coding:utf-8
  2.  
  3. num = (int(input("Digite um nº: ")))
  4. primo = True
  5.  
  6. if num == 0 or num ==1 or num == 2:
  7.     primo = True
  8. else:
  9.     if num % 2 == 0:
  10.         primo = False
  11.     else:
  12.         inicio = 3
  13.         while (inicio < num) and primo == True:
  14.             if num % inicio == 0:
  15.                 primo = False
  16.             else:
  17.                 inicio = inicio + 2
  18.                 primo = True
  19.  
  20.         if primo == True:
  21.             print("O nº %d é primo!" %(num))
  22.         else:
  23.             print("O nº %d NÃO é primo!" %(num))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top