Created
August 21, 2016 21:20
-
-
Save Spotik/784da613c5c6fac88c1c8674c36d05e0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| '''Desenvolva um algoritmo que leia do teclado um número inteiro e mostre na tela se esse número é primo | |
| ou não. Lembrando: um número primo é divisível somente por 1 e por ele mesmo.''' | |
| numero = input("Informe um número:\n") | |
| count = 1 | |
| soma = 0 | |
| while count <= numero: | |
| if (numero % count) == 0: | |
| soma += 1 | |
| count += 1 | |
| if soma == 2 or soma == 1: | |
| print "O número %d é primo" %(numero) | |
| else: | |
| print "O número %d é não é primo" %(numero) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment