Advertisement
nirjhor003

Untitled

Apr 20th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. int main(void)
  4. {
  5. int i,j,n,counter = 0;
  6. for(i=2; i<= 100; i++)
  7. {
  8. n=1;
  9. for(j=2; j < i; j++)
  10. {
  11. if(i%j==0)
  12. {
  13. n = 0;
  14. }
  15. }
  16.  
  17. if(n==1)
  18. {
  19. printf("%d is prime number\n",i);
  20. counter++; //counter = counter +1;
  21. }
  22.  
  23. }
  24.  
  25. printf("\t\t total prime numbers in [1 too 100] : %d \n\n",counter);
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement