Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(){
- int n,i, flag=0;
- scanf("%d", &n);
- /*Checking if n is NOT prime */
- for(i=2; i<n; i++){
- if(n%i==0){
- flag=1;
- }
- }
- if(flag==0){
- printf("%d is prime.\n", n);
- }
- else{
- printf("%d is not prime.\n", n);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement