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

Monday, July 17, 2017

PRIME NUMBER (Example 2)

/* 2 program of prime number and check from 2and so on */
#include<stdio.h>
#include<conio.h>
void main()
{
int i,n;
clrscr();
printf("Enter a number :");
scanf("%d",&n);
i=2;
while(i<=n-1)
{
if(n%i==0)
{
printf("Not a prime number ");
break;
}
i++;
}
if(i==n)
printf("prime number");
getch();
}

No comments:

Post a Comment