//This one is a little complicated
#include<stdio.h>
int main()
{ int x,q,no,s,originalno;
printf("Enter the Number: ");
scanf("%d",&no);
originalno=no;
for ( x=2;(no/x)>=1;x++)
{ if ((no%x)==0)
{
if (x==originalno)
{printf("%d is a PRIME number\n",originalno);}
s=(no/x);
no=s;
x=x-1;
}
}
if(x!=originalno)
{printf("%d is not a prime number\n",originalno);}
return 0;
}
I actually enjoyed reading through this posting.Many thanks.
ReplyDeleteConsulting - cPrime