Created
June 20, 2024 22:47
-
-
Save catalunha/0c5698cb6dc1191c02c7aea7ad5946a8 to your computer and use it in GitHub Desktop.
lista01pag05prog23
This file contains 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
void main() { | |
int n = 10; | |
print('Números primos até $n:'); | |
for (int i = 2; i <= n; i++) { | |
bool isPrime = true; | |
for (int j = 2; j <= i; j++) { | |
if (i != j && i % j == 0) { | |
isPrime = false; | |
break; | |
} | |
} | |
if (isPrime) { | |
print(i); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment