I don't think this page has a program to check whether an entered number is Vampire or not. I am providing a program to do so. It tells us whether it is Vampire or not, gives us all the possible fang pairs, and also gives you the number of fang-pairs available. Check it out...

Code:

Code:

#include<stdio.h>
#include<math.h>
void sort(long int *z,long int i);
void swap(long int *x,long int *y);
main()
{
long int a,b,c,d,e,f,g=1,i=0,j,k,l,t=0,m,n;
long int p[100],s[100];
printf("Enter the darned number: ");
scanf("%ld",&a);
b=a;
while (a>=1)
{
p[i]= (a%10);
++i;
a/=10;
}
if ((i%2)!=0)
printf("\n%ld has an odd (%ld) number of digits. It can't be a Vampire Number you dumbo!\n\n", b, i);
else
{
sort(p,i);
for (m=10;m<b;++m)
{
l=m;
if ((b%l)==0)
{
n= (b/l);
if ((((l%10)!=0) || ((n%10)!=0)) && ((l<(pow(10,i/2))) && (n<(pow(10,i/2)))) && (l<=n))
{
j=0,k=0,f=0;
c=l;
while (l>=1)
{
s[j]= (l%10);
++j;
l/=10;
}
d=n;
while (n>=1)
{
s[j]= (n%10);
++j;
n/=10;
}
sort(s,i);
for (e=0;e<i;++e)
{
if (p[e]==s[e])
++f;
}
if (f==i)
{
if (g==1)
{
printf("\nJesus ........ing Christ! This is a goddmaned Vampire Number!\n");
printf("\n%ld = ",b);
printf("(%ld*%ld) ",c,d);
--g, ++t;
}
else
printf("= (%ld*%ld) ",c,d);
++t;
}
}
}
}
}
if ((t==0) && (i%2==0))
printf("\nSorry dude. This ain't a Vampire Number!\n");
else
{
if (t>2)
printf("\n\nIt has %ld pairs of fangs.",t-1);
if (t==2)
printf("\n\nIt has 1 pair of fangs.");
}
}
void sort(long int *z,long int h)
{
long int u=h-1;
while (u>=0)
{
for(h=0;h<=(u-1);++h)
{
if (z[h]<=z[h+1])
swap(&z[h],&z[h+1]);
else
continue;
}
--u;
}
}
void swap(long int *x,long int *y)
{
long int t;
t=*x;
*x=*y;
*y=t;
}