#include <stdio.h>
int main() {
int a, b, c = 1, d = 1;
printf("\nDigite um numero: \n");
scanf("%i", &a);
do
{
++c;
b= a % c ;
if(b == 0 && c != 1 && c!=a)
{
d = 0;
}
}
while(c < a);
if(a == 2)
{
printf("\nPrimo");
}
else if(d == 0)
{
printf("\nNao Primo");
}
else if(d == 1)
{
printf("\nPrimo");
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: