Write the program form Armstrong no in c++?

Answer Posted / saravanan

#include<stdio.h>
#include<conio.h>
void main()
{
int sum=0,n,m;
clrscr();
scanf("%d",&n);
m=n;
while(n>0)
{
m=n%10;
sum=sum+(m*m*m);
n=n/10;
}
if(m==sum)
{
printf("the given number is amstrong");
else
printf("the given number is not amstrong");
}
getch();
}

Is This Answer Correct ?    97 Yes 70 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can non-public members of another instance of the class be retrieved by the method of the same class?

608


What is the main purpose of overloading operators?

586


Differentiate between realloc() and free().

592


What are associate containers?

614


Why should we use null or zero in a program?

600






What is the difference between mutex and binary semaphore?

610


In which situation the program terminates before reaching the breakpoint set by the user at the beginning of the mainq method?

584


Describe the advantage of an external iterator.

614


What does new do in c++?

633


What is scope operator in c++?

564


Is c or c++ more useful?

574


Explain the scope of resolution operator.

629


Define the process of error-handling in case of constructor failure?

565


What is the protected keyword used for?

614


What is an adaptor class in c++?

598