bouchnina

les nombres prem inf a n

Dec 11th, 2012
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.38 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int N,K,i,m=0;
  5. printf("Entrez un nombre N pour afficher les nombres premier inferieur a ce nombre :");
  6. scanf("%d",&N);
  7. do{
  8.     K=N-1;
  9.     printf("les nombres premier inferieur a %d sont :\n",N);
  10.     for(K=N-1;K>0;K--)
  11.         {
  12.         for(i=1,m=0;i<=K;i++)
  13.             {
  14.             if(K%i==0) m++;
  15.             }
  16.         if(K>2)
  17.             {if(m==2) printf("%d \n",K);}
  18.         }
  19.    
  20.    
  21.    
  22.     }while(K>=1);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment