C program to find prime numbers
#include<stdio.h>
int main(){
int num,i,count=0;
printf("Enter a number: ");
scanf("%d",&num);
for(i=2;i<=num/2;i++){
if(num%i==0){
count++;
break;
}
}
if(count==0 && num!= 1)
printf("%d is a prime number",num);
else
printf("%d is not a prime number",num);
return 0;
}
output:
Enter a number: 11
11 is a prime number
-----------------------------------------------
Write a C++ program to find prime numbers between answers .Write a C Program to check number is Prime number . How can you write a program that will determine if the.Program to print first n prime numbers in c.?
C program to determine prime number. Determining if a number is prime in c. C program to find given number is prime or not
0 comments:
Post a Comment