Twitter Feed Facebook Google Plus Youtube

Adsense responsive

Recent Post below header

Saturday, 2 February 2013

C PROGRAM: TO CHECK WHETHER A NUMBER IS PRIME OR NOT

CODING:
#include<conio.h>
#include<stdio.h>
void main()
{
int num,rm,i;
clrscr();
printf("Enter any number: ");
scanf("%d",&num);
for(i=2;i<=num-1;i++)
{
rm=num%i;
if(rm==0)
break;
}
if(rm==0)
printf("\n%d is not a prime number",num);
else
printf("\n%d is a prime number",num);
getch();
}


CODING

OUTPUT

For any query or suggestion please comment below...

No comments:

Post a comment