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

List down the guideline that should be followed while using friend function.

732


How do you import payscale data from non SAP to SAP?is it through LSMW or any other way is there?

3296


What is a constant reference?

705


What are compilers in c++?

700


Why is polymorphism useful?

671






On throwing an exception by the animal constructor in p = new animalq, can memory leak occur?

769


What is the equivalent of Pascal's Real a) unsigned int b) float c) char

670


How does a C++ structure differ from a C++ class?

712


Arrange Doubly linked list in the ascending order of its integral value and replace integer 5 with 7?

3798


Does c++ have string data type?

784


Are c and c++ similar?

671


What is the difference between strcpy() and strncpy()?

734


What is pointer in c++ with example?

616


Do you know the use of vtable?

743


What is the use of register keyword with the variables?

636