A C program to check whether a number is prime number or not.


// A C program to check whether a number is prime number or not

#include<stdio.h>
#include<conio.h>
void main()
{
int num,i,Prime=0;

printf("Enter a positive number\n");
scanf("%d",&num);
for(i=2;i<=(num/2);++i)
{
if(num%i==0)
{
Prime=1;
break;
}
}
if(Prime==0)
printf("%d is a Prime Number",num);
else
printf("%d is NOT a Prime Number",num);
getch();
}
Output:



A C program to check whether a number is prime number or not., my knowledge to you dude



























// A program to print the name 10 times.
//A C program to print ODD numbers from 1 to N using while loop.

Post a Comment

0 Comments