Skip to content
Home » C Programs » Armstrong Number in C Using For Loop

Armstrong Number in C Using For Loop

Simple armstrong number in c using for loop. Using this program we can find the number is Armstrong number or not for beginners to understand how to implement armstrong number in c using for loop

Armstrong Number Definition in C

An Armstrong number, also known as a narcissistic number, is the sum of its own digits’ cubes. 

As a result, narcissistic numbers are those that can be represented mathematically by manipulating their digits. The sum of a whole number’s digits’ nth powers is called an integer. 

For Loop Definition in C

In the C programming language, the for loop is used to iterate statements or parts of a program numerous times. 

It is commonly used to traverse data structures such as an array and a linked list. 

A for-loop (or simply for loop) is a control flow statement in computer science that specifies iteration and allows code to be executed repeatedly.

When the number of iterations is known before entering the loop, for-loops are commonly utilised. 

Armstrong Number in C Using For Loop

#include <stdio.h>
int main()
{
int num,r,sum=0,temp;
printf("Enter The Number");
scanf("%d",&num);
for(temp=num;num!=0;num=num/10)
{
r=num % 10;
sum=sum+(r*r*r);
}
if(sum==temp)
printf("%d is Armstrong Numbern",temp);
else
printf("%d is Not Armstrong Numbern",temp);
}

Output: 

Enter The Number153 

153 is Armstrong Number 

Armstrong Number Program in C Using While Loop 

C Program to Calculate Sine Value 

Delay Function in C Using For Loop 

Example Program For Pointer to Pointer in C 

C Program for Calculator Using Switch Case 

C++ Programs Examples With Output

PHP Programs Examples With Output 

C Programming Examples With Solutions 

Python Programs For Practice With Solutions 

Java Program Example With Output 

Binary releases – Code::Blocks

GDB online Debugger | Compiler – Code, Compile, Run, Debug online C, C++

Online Compiler and Editor/IDE for Java, C/C++, PHP, Python, Perl, etc

C (programming language)

Applications of C Programming That Will Make You Fall In Love With C