int main(){
int num,i,count=0;
printf("\nEnter a number:");
scanf("%d",&num);
for(i=2;i<=num/2;i++){
if(num%i==0){
count++;
break;
}
}
if(count==0)
printf("%d is a prime number",num);
else
printf("%d is not a prime number",num);
return 0;
}
Learn More :
Prime Number
- PRINT PRIME NUMBERS BETWEEN 1-300 USING BREAK AND CONTINUE IN C
- C Program to Check Prime Use Loop And Recursive
- C or C++ program to print prime number
- C or C++ Program To Print Prime Number
- C Program For Prime Number or Not
- C Program For Prime Number Using Function
- C Program For Prime Number
- Huge Prime in C Program
- C Program to Detection of a Prime Number
- C Program to print all prime numbers from 1 to 300.
- C Program To Find Prime Number And If Number Is Not Prime Then Find Factors
- C Program to Find Prime Number and Complex Number
- C Program to accept n numbers & store all prime numbers in an array & display this result
Check
- CHECKING LEAP YEAR USING C PROGRAM.
- Write a c program to check given string is palindrome number or not.
- C program to Check While packet(s) hasn't been acked
- C Program to Check Prime Use Loop And Recursive
- Given a numerical value, check if at least one of the elements of the vector is equal to the numerical value if so, say where in the negative case, say that there is no.
- C Program To Find The Length, Reverse Of A String And To Check It Is Palindrome or Not
- C Program To Check The Given Value Is Vowel
- C Function to Check Vowel
- C Program To Check Leap Year
- C Program To Check If It Is A Palindrome Numbers Or Not
- C Program to Check if a number is in an array[1000]
- Armstrong Number Checker in C
- C Program to Check Given String is Palindrome or Not
- C Program to Check Whether Number Is Perfect Or Not
- C Program To Alarm Check
- C Program To Read A Parenthesised Infix Expression From The User And Check Whether It Is Well Parenthesised Or Not
- Input a Number and Check if it's Palindrome or not C Program
- Input Number and Check if it's Armstrong C Program
- Input Number and Check if it's Even or Odd C Program