/* 1 program of prime number */
#include<stdio.h>
#include<conio.h>
void main()
{
int i,n,c=0;
clrscr();
printf("Enter a number :");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if(n%i==0)
c++;
}
if(c==2)
printf("Prime Number ");
else
printf("Not Prime Number");
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int i,n,c=0;
clrscr();
printf("Enter a number :");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if(n%i==0)
c++;
}
if(c==2)
printf("Prime Number ");
else
printf("Not Prime Number");
getch();
}
No comments:
Post a Comment