answersLogoWhite

0

  1. /* To check whether a number is Adam number or not */
  2. #include
  3. #include
  4. void main()
  5. {
  6. int i,n,n1,n2,ns,r,rev=0,nr=0,nrs;
  7. clrscr();
  8. printf("Enter a no.n");
  9. scanf("%d",&n);
  10. ns=n;
  11. n1=n*n;
  12. n2=n1;
  13. while(n2>0)
  14. {
  15. r=n2%10;
  16. n2=n2/10;
  17. rev=rev*10+r;
  18. }
  19. while(ns>0)
  20. {
  21. r=ns%10;
  22. ns=ns/10;
  23. nr=nr*10+r;
  24. }
  25. nrs=nr*nr;
  26. if (rev==nrs)
  27. printf("%d is an Adam no.n",n);
  28. else
  29. printf("%d is not an Adam no.n",n);
  30. getch();
  31. }
  32. }
User Avatar

Wiki User

13y ago

Still curious? Ask our experts.

Chat with our AI personalities

BeauBeau
You're doing better than you think!
Chat with Beau
LaoLao
The path is yours to walk; I am only here to hold up a mirror.
Chat with Lao
BlakeBlake
As your older brother, I've been where you are—maybe not exactly, but close enough.
Chat with Blake
More answers
  • #include
  • #include
  • void main()
  • {
  • int i,n,n1,n2,ns,r,rev=0,nr=0,nrs;
  • clrscr();
  • printf("Enter a no.n");
  • scanf("%d",&n);
  • ns=n;
  • n1=n*n;
  • n2=n1;
  • while(n2>0)
  • {
  • r=n2%10;
  • n2=n2/10;
  • rev=rev*10+r;
  • }
  • while(ns>0)
  • {
  • r=ns%10;
  • ns=ns/10;
  • nr=nr*10+r;
  • }
  • nrs=nr*nr;
  • if (rev==nrs)
  • printf("%d is an Adam no.n",n);
  • else
  • printf("%d is not an Adam no.n",n);
  • getch();
  • }
  • }
  • Read more: C_program_to_find_the_given_number_is_Adam_number

User Avatar

Wiki User

12y ago
User Avatar

Add your answer:

Earn +20 pts
Q: C program to find the given number is Adam number?
Write your answer...
Submit
Still have questions?
magnify glass
imp