wap to find whether a number entered by user is automorphic or not.

if u want to know what is automorphic number then go to-http://en.wikipedia.org/wiki/Automorphic_number

#include<stdio.h>
void main()
{
    long int count=1,n,a,m,div=1,i;
    printf("enter the number \n");
    scanf("%d",&n);
    a=n;
    while((n/10)!=0)
    {
    n=n/10;
    count++;
    }
    m=a*a;
    for(i=1;i<=count;i++)
        div=div*10;
    if(m%div==a)

    printf("\nit is an automorphic number");
        else
    printf("\nit is not an automorphic number");


}

NOTE-  i have compiled this program in codeblocks if u do it in turbo c++  use  conio.h  header file in the beginning  and getch()  a the  last.


output window (click to enlarge).



No comments:

Post a Comment

Implemet Stack in python

  class Stack : def __init__ ( self , data ): self . stack = [] if ( data ): self . stack . append ( da...