fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int n;
  5. printf("Enter the number: ");
  6. scanf("%d",&n);
  7. int a=0;
  8. for(int i=2;i<=n-1;i++){
  9. if(n%i==0){
  10. a=1;
  11. break;
  12. }
  13. if(a==0) printf("Prime");
  14. else printf("composite");
  15. }
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0s 5320KB
stdin
10
stdout
Enter the number: