Skip to content

Instantly share code, notes, and snippets.

@catalunha
Created June 20, 2024 22:47
Show Gist options
  • Save catalunha/0c5698cb6dc1191c02c7aea7ad5946a8 to your computer and use it in GitHub Desktop.
Save catalunha/0c5698cb6dc1191c02c7aea7ad5946a8 to your computer and use it in GitHub Desktop.
lista01pag05prog23
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