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