c code for prime Armstrong perfect numbers

  • c prime, Armstrong number perfect number
  • find prime Armstrong perfect numbers in c

    Using the function, write a program to find whether a number is prime, Armstrong, or perfect.

    Code

    #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> int checkPrimeNumber() { int i, n, prime = 1; printf("enter the number\n"); scanf("%d", &n); for (i = 2; i < n; i++) { if (n % i == 0) { prime = 0; } } if (prime == 0) { printf("the number is not prime\n"); } else { printf("the number is prime\n"); } } int main() { checkPrimeNumber(); return 0; }