Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Mar 21st, 2010 | Syntax: None | Size: 0.41 KB | Hits: 77 | Expires: Never
Copy text to clipboard
  1. #include<stdio.h>
  2. #include<conio.h>
  3. void main(void)
  4. {
  5. int i,k,rem;
  6. char ch;
  7. clrscr();
  8. while(1)
  9. {
  10. printf("enter a no");
  11. scanf("%d",&i);
  12. for (k=2;k<i;k++){
  13. rem=i%k;
  14. if(rem==0){
  15. printf("%d is not prime no",i);
  16. break;
  17. }}
  18. if (rem!=0){
  19. printf ("%d is a prime no",i);
  20. }
  21. printf("\n\n\tdo u wish to enter another no(y/n)?");
  22. ch=getche();
  23. if (ch=='n'){
  24. break;
  25. }
  26. }
  27. printf("\n\texiting....");
  28. getch();
  29. }