C Program to Check Prime or Armstrong Number Using User-defined Function

Example to check whether an integer is a prime number or an Armstrong or both by creating two separate functions. C Program to Check Prime or Armstrong Number Using User-defined Function To understand this example, you should have the knowledge of following C programming topics: C Program to Display Prime Numbers Between Intervals Using Function In this program, two user-defined functions checkPrimeNumber() and checkArmstrongNumber() are created. The checkPrimeNumber() returns 1 if the number entered by the user is a prime number. Similarly, checkArmstrongNumber() returns 1 if the number entered by the user is an Armstrong number. Example: Check Prime and Armstrong Number #include <stdio.h> #include <math.h> int checkPrimeNumber(int n); int checkArmstrongNumber(int n); int main() { int n, flag; printf("Enter a positive integer: "); ...