-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEX052.py
More file actions
31 lines (27 loc) · 663 Bytes
/
Copy pathEX052.py
File metadata and controls
31 lines (27 loc) · 663 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# NUMERO
num = int(input("Digite um numero: "))
a = 0
for c in range(1, num+1):
if num % c == 0:
print("\033[0:34m"+str(c), end=" ")
a += 1
else:
print("\033[0:31m"+str(c), end=" ")
if a == 2:
print("\033[0:0m"+"\nO numero {} é um numero primo!".format(num))
else:
print("\033[0:0m"+"\nO numero {} não é um umero primo".format(num))
# LISTA DE NUMEROS
num = int(input("Digite um numero: "))
a = 0
lista = []
for i in range(1, num+1):
for c in range(1, i+1):
if i % c == 0:
a += 1
if a == 2:
lista.append(i)
a = 0
print("Numeros primos: ")
for c in lista:
print(c, end=' ')