0
  1. #include<stdio.h>    
  2. #include<conio.h>    
  3. void main()
  4. {
  5. int n,i,m=0,flag=0;    //declaration of variables.
  6. clrscr();    //It clears the screen.
  7. printf(“Enter the number to check prime:”);
  8. scanf(“%d”,&n);
  9. m=n/2;
  10. for(i=2;i<=m;i++)
  11. {
  12. if(n%i==0)
  13. {
  14. printf(“Number is not prime”);
  15. flag=1;
  16. break;    //break keyword used to terminate from the loop.
  17. }
  18. }
  19. if(flag==0)
  20. printf(“Number is prime”);
  21. getch();    //It reads a character from the keyword.
  22. }
Ashifa Asked question June 24, 2023