Home » C Programs » C Program to Find Armstrong Number Using Recursion

# C Program to Find Armstrong Number Using Recursion

Basic armstrong number in c using recursion. In this program, we can execute the Armstrong number using recursion for beginners to understand the function concept in c.

## Armstrong Number Definition

The sum of the cubes of its own digits is equal to an Armstrong number, also known as a narcissistic number. The sum! of an Armstrong number’s digits raised to the third power equals the number itself.

## Math.h in C Program

The math. h header contains a number of mathematical functions as well as a macro. This library’s functions all take double as a parameter and return double as the result.

## Recursion Function in C

When a function in C calls a copy of itself, this is referred to as recursion. To put it another way, when a function calls itself, this is referred to as recursion. You must define an exit condition on that function when employing recursion; else, it will go into an indefinite loop. Using this program we can armstrong number in c using recursion

## Armstrong Number in C Using Recursion

``````//Armstrong Number in C Using Recursion
#include<stdio.h>
int func(int num)
{
if(num>0)
return (pow(num%10,3) +func(num/10));
}
int main()
{
int num;
printf("Enter The Number");
scanf("%d",&num);
if(func(num)==num)
printf("It Is An Armstrong Number");
else
printf("It Is Not An Armstrong Number");
}``````

Output of Armstrong Number in C Using Recursion:

Enter The Number45
It Is Not An Armstrong Number