Skip to content

Commit b70a861

Browse files
committed
doc: add comments
Loop structure: for. Prime numbers.
1 parent 9e05b2f commit b70a861

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

ex052.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#Prime numbers
12
#52- Write a program that reads an integer and tells whether or not it is a prime number.
23
number = int(input('Enter a integer number:'))
34
tot = 0
@@ -12,4 +13,23 @@
1213
if tot == 2:
1314
print('And that is why he is a prime number.')
1415
else:
15-
print('And that is why it is not a prime number.')
16+
print('And that is why it is not a prime number.')
17+
18+
19+
#Números primos
20+
#52: Faça um programa que leia um número inteiro e diga se ele é ou não um número primo.
21+
numero = int(input('Digite um número:'))
22+
total = 0
23+
for contador in range(1,numero,+1):
24+
if numero % contador == 0:
25+
print(end='')
26+
total += 1
27+
else:
28+
print(end='')
29+
if total == 2:
30+
print('O número é primo.')
31+
else:
32+
print('O número é impar.')
33+
34+
# PT- Estruturas de repetições: For.
35+
# EN- Loop structures: For.

0 commit comments

Comments
 (0)