Reginaldojs

exercicio 76,lista 3

Jun 23rd, 2012
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.53 KB | None | 0 0
  1. /*Leia um valor e informe seus divisores caso não ele seja primo, ou mostre na tela “É PRIMO” caso contrário.*/
  2.  
  3. #include<stdio.h>
  4. #include<stdlib.h>
  5. int main(){
  6.     int i,a, n, k;
  7.     printf(" Digite o numero: ");
  8.     scanf(" %d",&n);
  9.     k=0;
  10.     for(i=1;i<=n;i++){
  11.          if(n%i==0){
  12.             k++;
  13.             printf("%d eh divisor de %d\n",i,n);}      
  14.     }
  15.     if(k>2)
  16.       printf("O numero %d nao eh primo \n",n);
  17.     else
  18.       printf(" O numero %d eh primo \n",n);
  19.     system ("pause");
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment