Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(int argc, char **argv)
- {
- int num, verificaPrimo;
- int flag;
- printf("Informe o numero a ser analisado entre 0 e 1000: ");
- scanf("%i", &num);
- for(int i=2; i<num +1;i++)
- {
- verificaPrimo=num%i;
- // printf("verificaPrimo %d \n", verificaPrimo);
- if (num > i)
- {
- if (verificaPrimo==0)
- {
- printf("O valor %d nao e primo\n", num);
- break;
- }
- }
- else
- flag = 1;
- }
- if (flag == 1)
- printf("O valor %d e primo\n", num);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement