0% found this document useful (0 votes)
16 views2 pages

Computer Formulae for Number Types

Uploaded by

hitanshmdas1509
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views2 pages

Computer Formulae for Number Types

Uploaded by

hitanshmdas1509
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

COMPUTER FORMULAE

PALINDROME NUMBER
r=0, t=m;
while(m>0)
{
r=r*10+m%10;
m=m/10;
}

PERFECT NUMBER
int i, s=0;
for(i=1;i<k;i++)
{
if(k%i==0)
{
s=s+i;
}
}

FIBONACCI NUMBER
int i, a=0,b=1,c;
if(n==1)
{
[Link](a);
}
else
{
if(n==2)
{
[Link](a+","+b);
}
else
{
[Link](a+","+b);
}
for(i=3;i<=n;i++)
{
c=a+b;
[Link](","+c);
a=b;
b=c;
}
}

AUTOMORPHIC NUMBER
boolean automorphic(int m)
{
double r; int t=m; double sq;
sq= [Link](m,2);
r=sq%10;+
if(t==r)
{
return true;
}
else
{
return false;
}

You might also like