SlideShare a Scribd company logo
ARMSTRONG
NUMBERS
By: Tarun Sharma
(Lecturer Computer Science)
Contents
What is Armstrong Number? ................................................................................. 1
Examples of Armstrong Numbers .......................................................................... 2
Programs of Armstrong Numbers .......................................................................... 4
Program for Check a Single Armstrong Number.................................................. 4
Program for Check Armstrong Numbers between limit ...................................... 6
Armstrong Numbers Tarun Sharma
P a g e | 1
What is Armstrong Number?
An Armstrong number is any number of n digits which is equal to the sum of nth
power of digits in the number. Generally in most programming cases we consider
numbers from 000 to 999 that is 3 digit numbers. Thus, we also define Armstrong
number is any number of 3 digits as sum of cubes of digits in number.
Let us consider an example:
If ‘XYZ’ is a three digit Armstrong number, then
(X^3) + (Y^3) + (Z^3) = XYZ
If 'XYZA' is a four digit Armstrong number, then
(X^4)+(Y^4) + (Z^4) + (A^4) = XYZA and
If 'ABCDE' is a five digit Armstrong number then
(A^5) + (B^5) + (C^5) + (D^5) + (E^5) = ABCED and likewise.
Armstrong Numbers Tarun Sharma
P a g e | 2
Examples of Armstrong Numbers
Armstrong Numbers between different nth numbers of digits:
Between 1 to 9
Where n=1:
There are 9 single digit Armstrong numbers and they are 1-9.
Between 10 to 99
Where n=2:
There are no two digit Armstrong numbers.
Between 100 to 999
Where n=3:
There are 3 three digit Armstrong numbers and they are,
153 = 1^3 + 5^3 + 3^3 = 1+125+27 = 153
370 = 3^3 + 7^3 + 0^3 = 27+343+0 = 370
371 = 3^3 + 7^3 + 1^3 = 27+343+1 = 371
407 = 4^3 + 0^3 + 7^3 = 64+0+343 = 407
Between 1000 to 9999
Where n=4:
There are 4 four digit Armstrong numbers and they are:
1634 8208 9474
Armstrong Numbers Tarun Sharma
P a g e | 3
Between 10000 to 99999
Where n=5
There are 5 five digit Armstrong numbers and they are,
54748 92727 93084
Between 100000 to 999999
Where n=6:
There are 6 Six digit Armstrong numbers and they are,
548834
Between 1000000 to 9999999
Where n=7:
There are 7 Seven digit Armstrong numbers and they are,
1741725 4210818 9800817 9926315
Between 10000000 to 99999999
Where n=8:
There are 8 Eight digit Armstrong numbers and they are,
24678050 24678051 88593477
There are only 88 Armstrong numbers and the largest Armstrong number is a 39
digit number which is "115,132,219,018,763,992,565,095,597,973,971,522,401".
Armstrong Numbers Tarun Sharma
P a g e | 4
Programs of Armstrong Numbers
Solution of Armstrong Numbers in C Programming Language:
Program for Check a Single Armstrong Number
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<stdlib.h>
void main()
{
long int n, a,m, c, t, temp, p,i;
char ch;
clrscr();
printf("Enter Your Number:");
scanf("%ld",&n);
temp=t=n; m=0, p=1,c=0,a=0;
while(t>0)
{
c++;
t=t/10;
}
while(n>0)
{
m=n%10;
p=1;
Armstrong Numbers Tarun Sharma
P a g e | 5
for(i=1;i<=c;i++)
{
p=p*m;
}
a=a+p;
n=n/10;
}
if(a==temp)
{
printf("Number %ld is a Armstrong Number.",temp);
}
else
{
printf("Number %ld is Not a Armstrong Number.",temp);
}
printf("nnnDo you want to continue... if yes press 1 else any key..");
ch=getch();
if(ch=='1')
{
main();
}
else
{
exit(0);
}
Armstrong Numbers Tarun Sharma
P a g e | 6
getch();
}
Output:
Program for Check Armstrong Numbers between limit
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<stdlib.h>
void main()
{
long int n, a,m, c, t, temp, p,i,l,j;
char ch;
clrscr();
printf("Enter Your Limit:");
scanf("%ld",&l);
printf("nnArmstrong numbers between 1 to %ld arenn",l);
for(j=1;j<=l;j++)
{
temp=t=n=j;
Armstrong Numbers Tarun Sharma
P a g e | 7
m=0, p=1,c=0,a=0;
while(t>0)
{
c++;
t=t/10;
}
while(n>0)
{
m=n%10;
p=1;
for(i=1;i<=c;i++)
{
p=p*m;
}
a=a+p;
n=n/10;
}
if(a==temp)
{
printf("%ldt",temp);
}
}
printf("nnnDo you want to continue... if yes press 1 else any key..");
ch=getch();
if(ch=='1')
Armstrong Numbers Tarun Sharma
P a g e | 8
{
main();
}
else
{
exit(0);
}
getch();
}
Output:
Armstrong Numbers Tarun Sharma
P a g e | 9
Thank You

More Related Content

What's hot

Python Dictionary.pptx
Python Dictionary.pptxPython Dictionary.pptx
Python Dictionary.pptx
Sanad Bhowmik
 
Function in c program
Function in c programFunction in c program
Function in c program
umesh patil
 
Python Basics
Python Basics Python Basics
Python Basics
Adheetha O. V
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
Syed Zaid Irshad
 
C programming
C programmingC programming
C programming
Sivakumar Palani
 
Python strings
Python stringsPython strings
Python strings
Mohammed Sikander
 
Basic Python Programming: Part 01 and Part 02
Basic Python Programming: Part 01 and Part 02Basic Python Programming: Part 01 and Part 02
Basic Python Programming: Part 01 and Part 02
Fariz Darari
 
Pointers and Dynamic Memory Allocation
Pointers and Dynamic Memory AllocationPointers and Dynamic Memory Allocation
Pointers and Dynamic Memory Allocation
Rabin BK
 
Character Array and String
Character Array and StringCharacter Array and String
Character Array and String
Tasnima Hamid
 
Circular Queue data structure
Circular Queue data structureCircular Queue data structure
Circular Queue data structure
Dhananjaysinh Jhala
 
Print input-presentation
Print input-presentationPrint input-presentation
Print input-presentation
Martin McBride
 
Command line arguments
Command line argumentsCommand line arguments
Command line arguments
Ashok Raj
 
Intro to Python Programming Language
Intro to Python Programming LanguageIntro to Python Programming Language
Intro to Python Programming Language
Dipankar Achinta
 
VTU DSA Lab Manual
VTU DSA Lab ManualVTU DSA Lab Manual
VTU DSA Lab Manual
AkhilaaReddy
 
Python Loops Tutorial | Python For Loop | While Loop Python | Python Training...
Python Loops Tutorial | Python For Loop | While Loop Python | Python Training...Python Loops Tutorial | Python For Loop | While Loop Python | Python Training...
Python Loops Tutorial | Python For Loop | While Loop Python | Python Training...
Edureka!
 
C++ Language
C++ LanguageC++ Language
C++ Language
Syed Zaid Irshad
 
RECURSION IN C
RECURSION IN C RECURSION IN C
RECURSION IN C
v_jk
 
Operation on string presentation
Operation on string presentationOperation on string presentation
Operation on string presentation
Aliul Kadir Akib
 
Strings in C
Strings in CStrings in C
Strings in C
Kamal Acharya
 
c++ programming Unit 2 basic structure of a c++ program
c++ programming Unit 2 basic structure of a c++ programc++ programming Unit 2 basic structure of a c++ program
c++ programming Unit 2 basic structure of a c++ program
AAKASH KUMAR
 

What's hot (20)

Python Dictionary.pptx
Python Dictionary.pptxPython Dictionary.pptx
Python Dictionary.pptx
 
Function in c program
Function in c programFunction in c program
Function in c program
 
Python Basics
Python Basics Python Basics
Python Basics
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
C programming
C programmingC programming
C programming
 
Python strings
Python stringsPython strings
Python strings
 
Basic Python Programming: Part 01 and Part 02
Basic Python Programming: Part 01 and Part 02Basic Python Programming: Part 01 and Part 02
Basic Python Programming: Part 01 and Part 02
 
Pointers and Dynamic Memory Allocation
Pointers and Dynamic Memory AllocationPointers and Dynamic Memory Allocation
Pointers and Dynamic Memory Allocation
 
Character Array and String
Character Array and StringCharacter Array and String
Character Array and String
 
Circular Queue data structure
Circular Queue data structureCircular Queue data structure
Circular Queue data structure
 
Print input-presentation
Print input-presentationPrint input-presentation
Print input-presentation
 
Command line arguments
Command line argumentsCommand line arguments
Command line arguments
 
Intro to Python Programming Language
Intro to Python Programming LanguageIntro to Python Programming Language
Intro to Python Programming Language
 
VTU DSA Lab Manual
VTU DSA Lab ManualVTU DSA Lab Manual
VTU DSA Lab Manual
 
Python Loops Tutorial | Python For Loop | While Loop Python | Python Training...
Python Loops Tutorial | Python For Loop | While Loop Python | Python Training...Python Loops Tutorial | Python For Loop | While Loop Python | Python Training...
Python Loops Tutorial | Python For Loop | While Loop Python | Python Training...
 
C++ Language
C++ LanguageC++ Language
C++ Language
 
RECURSION IN C
RECURSION IN C RECURSION IN C
RECURSION IN C
 
Operation on string presentation
Operation on string presentationOperation on string presentation
Operation on string presentation
 
Strings in C
Strings in CStrings in C
Strings in C
 
c++ programming Unit 2 basic structure of a c++ program
c++ programming Unit 2 basic structure of a c++ programc++ programming Unit 2 basic structure of a c++ program
c++ programming Unit 2 basic structure of a c++ program
 

Viewers also liked

C Question Paper Solution - MDSU Ajmer
C Question Paper Solution - MDSU AjmerC Question Paper Solution - MDSU Ajmer
C Question Paper Solution - MDSU Ajmer
Tarun Sharma
 
Easter risingsites
Easter risingsitesEaster risingsites
Easter risingsites
williemct
 
Alzheimer Disease
Alzheimer DiseaseAlzheimer Disease
Alzheimer Disease
Hatem Shehata
 
Risk management i
Risk management iRisk management i
Risk management i
Dhani Ahmad
 
Secure
SecureSecure
Secure
Dhani Ahmad
 
Security policy
Security policySecurity policy
Security policy
Dhani Ahmad
 
Risk management ii
Risk management iiRisk management ii
Risk management ii
Dhani Ahmad
 
Alzheimer’s disease
Alzheimer’s diseaseAlzheimer’s disease
Alzheimer’s disease
Akhil Joseph
 
The need for security
The need for securityThe need for security
The need for security
Dhani Ahmad
 
Security technologies
Security technologiesSecurity technologies
Security technologies
Dhani Ahmad
 
Legal, ethical & professional issues
Legal, ethical & professional issuesLegal, ethical & professional issues
Legal, ethical & professional issues
Dhani Ahmad
 
Physical security
Physical securityPhysical security
Physical security
Dhani Ahmad
 
Security and personnel
Security and personnelSecurity and personnel
Security and personnel
Dhani Ahmad
 
Power of ict
Power of ictPower of ict
Power of ict
Harsh Shinde
 
Generations of Programming Languages
Generations of Programming LanguagesGenerations of Programming Languages
Generations of Programming LanguagesTarun Sharma
 

Viewers also liked (15)

C Question Paper Solution - MDSU Ajmer
C Question Paper Solution - MDSU AjmerC Question Paper Solution - MDSU Ajmer
C Question Paper Solution - MDSU Ajmer
 
Easter risingsites
Easter risingsitesEaster risingsites
Easter risingsites
 
Alzheimer Disease
Alzheimer DiseaseAlzheimer Disease
Alzheimer Disease
 
Risk management i
Risk management iRisk management i
Risk management i
 
Secure
SecureSecure
Secure
 
Security policy
Security policySecurity policy
Security policy
 
Risk management ii
Risk management iiRisk management ii
Risk management ii
 
Alzheimer’s disease
Alzheimer’s diseaseAlzheimer’s disease
Alzheimer’s disease
 
The need for security
The need for securityThe need for security
The need for security
 
Security technologies
Security technologiesSecurity technologies
Security technologies
 
Legal, ethical & professional issues
Legal, ethical & professional issuesLegal, ethical & professional issues
Legal, ethical & professional issues
 
Physical security
Physical securityPhysical security
Physical security
 
Security and personnel
Security and personnelSecurity and personnel
Security and personnel
 
Power of ict
Power of ictPower of ict
Power of ict
 
Generations of Programming Languages
Generations of Programming LanguagesGenerations of Programming Languages
Generations of Programming Languages
 

Similar to Armstrong numbers

grey relational analysis of Multi objective problem
grey relational analysis of Multi objective problemgrey relational analysis of Multi objective problem
grey relational analysis of Multi objective problem
jsanthakumar1987
 
Sensor Fusion Study - Ch3. Least Square Estimation [강소라, Stella, Hayden]
Sensor Fusion Study - Ch3. Least Square Estimation [강소라, Stella, Hayden]Sensor Fusion Study - Ch3. Least Square Estimation [강소라, Stella, Hayden]
Sensor Fusion Study - Ch3. Least Square Estimation [강소라, Stella, Hayden]
AI Robotics KR
 
Arrays in C language
Arrays in C languageArrays in C language
Arrays in C language
Shubham Sharma
 
1-4 Scientific Notation
1-4 Scientific Notation1-4 Scientific Notation
1-4 Scientific Notationrkelch
 
How to use a Kalman Filter in Brand Tracking?
How to use a Kalman Filter in Brand Tracking?How to use a Kalman Filter in Brand Tracking?
How to use a Kalman Filter in Brand Tracking?
Ray Poynter
 
Trigonometry_Short_Course_Tutorial_Lauren_Johnson.pdf
Trigonometry_Short_Course_Tutorial_Lauren_Johnson.pdfTrigonometry_Short_Course_Tutorial_Lauren_Johnson.pdf
Trigonometry_Short_Course_Tutorial_Lauren_Johnson.pdf
ShreyanBanerjee5
 
3-measurement-161127184347.pptx
3-measurement-161127184347.pptx3-measurement-161127184347.pptx
3-measurement-161127184347.pptx
DinoraSattorzoda
 
Data mining seminar report
Data mining seminar reportData mining seminar report
Data mining seminar reportmayurik19
 
Chap08
Chap08Chap08
Chap08
Syam Kumar
 
P3 t1 math booklet
P3 t1 math bookletP3 t1 math booklet
P3 t1 math booklet
أمنية وجدى
 
Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithm
Meshu Debnath
 
Introduction to computing Processing and performance.pdf
Introduction to computing Processing and performance.pdfIntroduction to computing Processing and performance.pdf
Introduction to computing Processing and performance.pdf
TulasiramKandula1
 
SafeML: Safety Monitoring of Machine Learning Classifiers through Statistical...
SafeML: Safety Monitoring of Machine Learning Classifiers through Statistical...SafeML: Safety Monitoring of Machine Learning Classifiers through Statistical...
SafeML: Safety Monitoring of Machine Learning Classifiers through Statistical...
Koorosh Aslansefat
 
Physical quantities and Measurements.ppt
Physical quantities and Measurements.pptPhysical quantities and Measurements.ppt
Physical quantities and Measurements.ppt
HabyarimanaProjecte
 
Monte Carlo Simulation
Monte Carlo SimulationMonte Carlo Simulation
Monte Carlo Simulation
Deepti Singh
 
Solving Transportation Problems with Hexagonal Fuzzy Numbers Using Best Candi...
Solving Transportation Problems with Hexagonal Fuzzy Numbers Using Best Candi...Solving Transportation Problems with Hexagonal Fuzzy Numbers Using Best Candi...
Solving Transportation Problems with Hexagonal Fuzzy Numbers Using Best Candi...
IJERA Editor
 
C# Arrays
C# ArraysC# Arrays
C# Arrays
Hock Leng PUAH
 
Sample project-Quality Circle
Sample project-Quality CircleSample project-Quality Circle
Sample project-Quality Circle
Mohamed Yusuff
 
JEE Coaching Center In Jalandhar | 9463138669 | ANAND CLASSES
JEE Coaching Center In Jalandhar  | 9463138669 | ANAND CLASSESJEE Coaching Center In Jalandhar  | 9463138669 | ANAND CLASSES
JEE Coaching Center In Jalandhar | 9463138669 | ANAND CLASSES
ANAND CLASSES - A SCHOOL OF COMPETITIONS
 

Similar to Armstrong numbers (20)

grey relational analysis of Multi objective problem
grey relational analysis of Multi objective problemgrey relational analysis of Multi objective problem
grey relational analysis of Multi objective problem
 
Sensor Fusion Study - Ch3. Least Square Estimation [강소라, Stella, Hayden]
Sensor Fusion Study - Ch3. Least Square Estimation [강소라, Stella, Hayden]Sensor Fusion Study - Ch3. Least Square Estimation [강소라, Stella, Hayden]
Sensor Fusion Study - Ch3. Least Square Estimation [강소라, Stella, Hayden]
 
Arrays in C language
Arrays in C languageArrays in C language
Arrays in C language
 
1-4 Scientific Notation
1-4 Scientific Notation1-4 Scientific Notation
1-4 Scientific Notation
 
How to use a Kalman Filter in Brand Tracking?
How to use a Kalman Filter in Brand Tracking?How to use a Kalman Filter in Brand Tracking?
How to use a Kalman Filter in Brand Tracking?
 
1746nm002
1746nm0021746nm002
1746nm002
 
Trigonometry_Short_Course_Tutorial_Lauren_Johnson.pdf
Trigonometry_Short_Course_Tutorial_Lauren_Johnson.pdfTrigonometry_Short_Course_Tutorial_Lauren_Johnson.pdf
Trigonometry_Short_Course_Tutorial_Lauren_Johnson.pdf
 
3-measurement-161127184347.pptx
3-measurement-161127184347.pptx3-measurement-161127184347.pptx
3-measurement-161127184347.pptx
 
Data mining seminar report
Data mining seminar reportData mining seminar report
Data mining seminar report
 
Chap08
Chap08Chap08
Chap08
 
P3 t1 math booklet
P3 t1 math bookletP3 t1 math booklet
P3 t1 math booklet
 
Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithm
 
Introduction to computing Processing and performance.pdf
Introduction to computing Processing and performance.pdfIntroduction to computing Processing and performance.pdf
Introduction to computing Processing and performance.pdf
 
SafeML: Safety Monitoring of Machine Learning Classifiers through Statistical...
SafeML: Safety Monitoring of Machine Learning Classifiers through Statistical...SafeML: Safety Monitoring of Machine Learning Classifiers through Statistical...
SafeML: Safety Monitoring of Machine Learning Classifiers through Statistical...
 
Physical quantities and Measurements.ppt
Physical quantities and Measurements.pptPhysical quantities and Measurements.ppt
Physical quantities and Measurements.ppt
 
Monte Carlo Simulation
Monte Carlo SimulationMonte Carlo Simulation
Monte Carlo Simulation
 
Solving Transportation Problems with Hexagonal Fuzzy Numbers Using Best Candi...
Solving Transportation Problems with Hexagonal Fuzzy Numbers Using Best Candi...Solving Transportation Problems with Hexagonal Fuzzy Numbers Using Best Candi...
Solving Transportation Problems with Hexagonal Fuzzy Numbers Using Best Candi...
 
C# Arrays
C# ArraysC# Arrays
C# Arrays
 
Sample project-Quality Circle
Sample project-Quality CircleSample project-Quality Circle
Sample project-Quality Circle
 
JEE Coaching Center In Jalandhar | 9463138669 | ANAND CLASSES
JEE Coaching Center In Jalandhar  | 9463138669 | ANAND CLASSESJEE Coaching Center In Jalandhar  | 9463138669 | ANAND CLASSES
JEE Coaching Center In Jalandhar | 9463138669 | ANAND CLASSES
 

More from Tarun Sharma

Control Flow Statements
Control Flow Statements Control Flow Statements
Control Flow Statements
Tarun Sharma
 
C Token’s
C Token’sC Token’s
C Token’s
Tarun Sharma
 
Introduction of c programming
Introduction of c programmingIntroduction of c programming
Introduction of c programming
Tarun Sharma
 
Data types in C
Data types in CData types in C
Data types in C
Tarun Sharma
 
Introduction to C Language
Introduction to C LanguageIntroduction to C Language
Introduction to C Language
Tarun Sharma
 
Remote Desktop Access
Remote Desktop AccessRemote Desktop Access
Remote Desktop AccessTarun Sharma
 

More from Tarun Sharma (6)

Control Flow Statements
Control Flow Statements Control Flow Statements
Control Flow Statements
 
C Token’s
C Token’sC Token’s
C Token’s
 
Introduction of c programming
Introduction of c programmingIntroduction of c programming
Introduction of c programming
 
Data types in C
Data types in CData types in C
Data types in C
 
Introduction to C Language
Introduction to C LanguageIntroduction to C Language
Introduction to C Language
 
Remote Desktop Access
Remote Desktop AccessRemote Desktop Access
Remote Desktop Access
 

Recently uploaded

Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
kimdan468
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
Krisztián Száraz
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 

Recently uploaded (20)

Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 

Armstrong numbers

  • 2. Contents What is Armstrong Number? ................................................................................. 1 Examples of Armstrong Numbers .......................................................................... 2 Programs of Armstrong Numbers .......................................................................... 4 Program for Check a Single Armstrong Number.................................................. 4 Program for Check Armstrong Numbers between limit ...................................... 6
  • 3. Armstrong Numbers Tarun Sharma P a g e | 1 What is Armstrong Number? An Armstrong number is any number of n digits which is equal to the sum of nth power of digits in the number. Generally in most programming cases we consider numbers from 000 to 999 that is 3 digit numbers. Thus, we also define Armstrong number is any number of 3 digits as sum of cubes of digits in number. Let us consider an example: If ‘XYZ’ is a three digit Armstrong number, then (X^3) + (Y^3) + (Z^3) = XYZ If 'XYZA' is a four digit Armstrong number, then (X^4)+(Y^4) + (Z^4) + (A^4) = XYZA and If 'ABCDE' is a five digit Armstrong number then (A^5) + (B^5) + (C^5) + (D^5) + (E^5) = ABCED and likewise.
  • 4. Armstrong Numbers Tarun Sharma P a g e | 2 Examples of Armstrong Numbers Armstrong Numbers between different nth numbers of digits: Between 1 to 9 Where n=1: There are 9 single digit Armstrong numbers and they are 1-9. Between 10 to 99 Where n=2: There are no two digit Armstrong numbers. Between 100 to 999 Where n=3: There are 3 three digit Armstrong numbers and they are, 153 = 1^3 + 5^3 + 3^3 = 1+125+27 = 153 370 = 3^3 + 7^3 + 0^3 = 27+343+0 = 370 371 = 3^3 + 7^3 + 1^3 = 27+343+1 = 371 407 = 4^3 + 0^3 + 7^3 = 64+0+343 = 407 Between 1000 to 9999 Where n=4: There are 4 four digit Armstrong numbers and they are: 1634 8208 9474
  • 5. Armstrong Numbers Tarun Sharma P a g e | 3 Between 10000 to 99999 Where n=5 There are 5 five digit Armstrong numbers and they are, 54748 92727 93084 Between 100000 to 999999 Where n=6: There are 6 Six digit Armstrong numbers and they are, 548834 Between 1000000 to 9999999 Where n=7: There are 7 Seven digit Armstrong numbers and they are, 1741725 4210818 9800817 9926315 Between 10000000 to 99999999 Where n=8: There are 8 Eight digit Armstrong numbers and they are, 24678050 24678051 88593477 There are only 88 Armstrong numbers and the largest Armstrong number is a 39 digit number which is "115,132,219,018,763,992,565,095,597,973,971,522,401".
  • 6. Armstrong Numbers Tarun Sharma P a g e | 4 Programs of Armstrong Numbers Solution of Armstrong Numbers in C Programming Language: Program for Check a Single Armstrong Number #include<stdio.h> #include<conio.h> #include<math.h> #include<stdlib.h> void main() { long int n, a,m, c, t, temp, p,i; char ch; clrscr(); printf("Enter Your Number:"); scanf("%ld",&n); temp=t=n; m=0, p=1,c=0,a=0; while(t>0) { c++; t=t/10; } while(n>0) { m=n%10; p=1;
  • 7. Armstrong Numbers Tarun Sharma P a g e | 5 for(i=1;i<=c;i++) { p=p*m; } a=a+p; n=n/10; } if(a==temp) { printf("Number %ld is a Armstrong Number.",temp); } else { printf("Number %ld is Not a Armstrong Number.",temp); } printf("nnnDo you want to continue... if yes press 1 else any key.."); ch=getch(); if(ch=='1') { main(); } else { exit(0); }
  • 8. Armstrong Numbers Tarun Sharma P a g e | 6 getch(); } Output: Program for Check Armstrong Numbers between limit #include<stdio.h> #include<conio.h> #include<math.h> #include<stdlib.h> void main() { long int n, a,m, c, t, temp, p,i,l,j; char ch; clrscr(); printf("Enter Your Limit:"); scanf("%ld",&l); printf("nnArmstrong numbers between 1 to %ld arenn",l); for(j=1;j<=l;j++) { temp=t=n=j;
  • 9. Armstrong Numbers Tarun Sharma P a g e | 7 m=0, p=1,c=0,a=0; while(t>0) { c++; t=t/10; } while(n>0) { m=n%10; p=1; for(i=1;i<=c;i++) { p=p*m; } a=a+p; n=n/10; } if(a==temp) { printf("%ldt",temp); } } printf("nnnDo you want to continue... if yes press 1 else any key.."); ch=getch(); if(ch=='1')
  • 10. Armstrong Numbers Tarun Sharma P a g e | 8 { main(); } else { exit(0); } getch(); } Output:
  • 11. Armstrong Numbers Tarun Sharma P a g e | 9 Thank You