0% found this document useful (0 votes)
16 views2 pages

Exp 4 Armstrong Number

Uploaded by

hole.prateek47
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views2 pages

Exp 4 Armstrong Number

Uploaded by

hole.prateek47
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Name: Prateek Hole Branch: ECS

Batch: B1 Rollno: 15

Experiment 4
Aim: Write a C program to find the whether the number is an AMSTRONG number or not.
Theory:
An Armstrong number, also known as a narcissistic number, is defined as a number that is equal
to the sum of its own digits each raised to the power of the number of digits in that number.
For example, the number 153 is an Armstrong number because:
13 + 53 + 33 = 1 + 125 + 27 = 153
Since, Sum = Number
Algorithm:
1. Start
2. Input an integer in variable n
3. insert value of n into num
4. Using while loop
A. while "n" is not equal to zero
B. Using modulus operator to extract each digit from number and storing it in
variable rem
C. By arithmetic operation, finding sum by using rem raised to the power 3
D. The digit is then removed from n by performing integer division by 10.
E. Go to step A
5. If num = sum
• Display "Given number is armstrong "
Else
• Display "Given number is not armstrong"
6. Stop
Flowchart:

Code:

Output:

Conclusion:
In conclusion, the C program for checking Armstrong numbers effectively illustrates
fundamental programming concepts such as loops, conditionals, and mathematical calculations.
By following a structured algorithm, it accurately determines whether a given integer meets the
criteria of an Armstrong number.

You might also like