PRIME NUMBER PROGRAM IN C
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int n, i, p=0;
int n, i, p=0;
printf("Enter any number:");
scanf("%d",&n);
for(i=2; i<n; i++)
{
if(n%i == 0)
{
p=1;
break;
}}
scanf("%d",&n);
for(i=2; i<n; i++)
{
if(n%i == 0)
{
p=1;
break;
}}
if(p == 0)
printf("Number is prime");
else
printf("Number is not prime");
getch();
}
----------------------------
OUTPUT
----------------------------
Enter any number: 9
Number is not prime
PALINDROME IN C >>
0 Comments