Advertisement
QUIZERA

prime number application

Feb 15th, 2019
406
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main() {
  5. int num,i,j,c,sum ;
  6.  
  7. printf("please enter the number?\n");
  8. scanf("%d",&num);
  9.  
  10. for (j=1;j<=num;j++){
  11. for (i=1,c=0;i<=j;i++){
  12.  
  13.  
  14.  
  15.  
  16.  
  17. if (j%i==0){
  18. c++;
  19. }
  20. }
  21. if (c==2){
  22. printf("%d\n",j);
  23. sum =i+j+c
  24. printf("%d",sum);
  25. }
  26. }
  27.  
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement