Automorphic Number solution using c language--programming_info problem 21

Automorphic Number:

# include <stdio.h>
# include <stdlib.h> # include <stdbool.h> bool chkAutomor(int num1) { int sqno = num1 * num1; while (num1 > 0) { if (num1 % 10 != sqno % 10) return false; num1 /= 10; sqno /= 10; } return true; } int main() { int auno;
    printf(" Input a number: ");
    scanf("%d",&auno);     if( chkAutomor(auno)) printf(" The given number is an Automorphic Number.\n"); else printf(" The given number is not an Automorphic Number.\n"); return 0; }
Share:

No comments:

Post a Comment

Translate

Recommended platforms

  1. codechef
  2. hackerrank
  3. codeforces
  4. leetcode
  5. hackerearth

Popular Posts

programming_info. Powered by Blogger.

Blog Archive

Recent Posts

other platforms

  • geeks for geeks
  • w3schools
  • codepen
  • skillshare
  • udemy

Pages

reader support Support