Reginaldojs

exercicio 11,lista 3

May 31st, 2012
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.37 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. int main(){
  4.     int n,i,k;
  5.     printf("digite um nº:");
  6.     scanf("%d",&n);
  7.     k=100000;
  8.     for(i=n-1;i>1;i--){
  9.         if(n%i==0)
  10.            k=1;
  11.     }
  12.            if(k==1)
  13.            printf("%d nao eh primo\n",n);
  14.            else
  15.            printf("%d eh primo\n",n);
  16.            
  17.     system("pause");
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment