Write a program in ‘C’ to print automorphic numbers. The automorphic number is a number in which the square of the number contains the number in the end. 10m Dec2005

By | June 12, 2014

Write a program in ‘C’ to print automorphic numbers. The automorphic number is a number in which the square of the number contains the number in the end. Example: (a) 5; 25 (b) 6; 36. 10m Dec2005

#include<stdio.h>
void main()
{
  int SQ,i,NUM;
  clrscr();
  printf(“AUTOMORPHIC NUMBERS BETWEEN 0 TO 999 ARE : “);
  for(i=2;i<10;i++)
  {
      SQ=i*i;
      NUM=SQ%10;
      if(i==NUM)
 printf(“\nNUMBER = %d SQUARE = %d”,NUM,SQ);
  }
  for(i=10;i<100;i++)
  {
      SQ=i*i;
      NUM=SQ%100;
      if(i==NUM)
 printf(“\nNUMBER = %d SQUARE = %d”,NUM,SQ);
  }
  getch();
}

#include<stdio.h>
void main()
{
  int SQ,i,NUM;
  clrscr();
  printf("AUTOMORPHIC NUMBERS BETWEEN 0 TO 999 ARE : ");
  for(i=2;i<10;i++)
  {
      SQ=i*i;
      NUM=SQ%10;
      if(i==NUM)
 printf("\nNUMBER = %d SQUARE = %d",NUM,SQ);
  }
  for(i=10;i<100;i++)
  {
      SQ=i*i;
      NUM=SQ%100;
      if(i==NUM)
 printf("\nNUMBER = %d SQUARE = %d",NUM,SQ);
  }
  getch();
}

Screen Shots:-

C_program_Automorphic

C_program_Automorphic_Output

Leave a Reply