Write the program form Armstrong no in c++?

Answer Posted / ashish ranjan

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

Is This Answer Correct ?    13 Yes 10 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the full form nasa?

595


What is array in c++ pdf?

554


What does the following code do: int c=0; cout< a) Undefined *Updated* b) 01 c) 00

634


How are Structure passing and returning implemented by the compiler?

593


Which function should be used to free the memory allocated by calloc()?

587






What is c++ virtual inheritance?

595


What is the main purpose of c++?

541


What language is a dll written in?

546


What is format for defining a structure?

586


A mXn matrix is given and rows and column are sorted as shown below.Write a function that search a desired entered no in the matrix .with minimum complexity 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

3238


Array base access faster or pointer base access is faster?

1813


How can you say that a template is better than a base class?

580


Why was c++ made?

652


What is doubly linked list in c++?

630


What are the uses of typedef in a program?

614