Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

check whether a number is prime or not in c

int n=7,i,flag=0;
	for(i=2;i<n/2;i++){
		if(n%i==0){
			flag=1;
			break;
		}
	}

	if(flag==0){
	printf("Prime number");

	}else{
		printf("not prime number");
	}
Source by www.w3schools.in #
 
PREVIOUS NEXT
Tagged: #check #number #prime
ADD COMMENT
Topic
Name
1+6 =