google-site-verification: googlef8aa845b858144d3.html COMPUTER SCIENCE NOTES: PRIME NUMBER (Example 1)

Monday, July 17, 2017

PRIME NUMBER (Example 1)

/* 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();
}

No comments:

Post a Comment