Created
December 6, 2012 21:45
-
-
Save arruda/4228764 to your computer and use it in GitHub Desktop.
AOU exercicio awk
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
{num=$1 | |
for (div = 2; div*div <= num; div++) | |
if (num % div == 0) | |
break | |
if (num % div == 0) | |
printf "%d nao eh primo\n", num | |
else | |
printf "%d eh primo\n",num} |
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
echo 5 | awk -f awk_primo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment