Advertisement
weldisalves

Lista 03 - exercício 11

Jun 13th, 2013
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.49 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. /* 11. Verifique se um número é primo ou não. */
  4.  
  5. int main()
  6. {
  7.     int numero,i,verificador=0;
  8.  
  9.     printf("\n Digite um numero: ");
  10.     scanf("%d",&numero);
  11.  
  12.     for(i=1;i<=numero;i++)
  13.     {
  14.         if(numero % i == 0)
  15.         {
  16.             verificador ++;
  17.         }
  18.     }
  19.     if(verificador > 2)
  20.         {
  21.             printf("\n Naum eh primo!!");
  22.         }else{
  23.             printf("\n Eh primo!!");
  24.             }
  25.  
  26.  
  27.  
  28.     getch();
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement