Write the program form Armstrong no in c++?

Answer Posted / rahul puri

#include<stdio.h>
#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 ?    48 Yes 41 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the syntax for a for loop?

695


What is c++ best used for?

654


What c++ is used for?

672


What is array give example?

674


Define a nested class.

699






What are its advantages and disadvantages of multiple inheritances (virtual inheritance)?

707


Explain differences between new() and delete()?

705


Explain data encapsulation?

762


Can non graphic characters be used and processed in C++?

795


Discuss the effects occur, after an exception thrown by a member function is unspecified by an exception specification?

728


What is format for defining a structure?

685


Is c++ a difficult language?

665


What are c++ stream classes?

652


What is the use of pointer in c++ with example?

642


What is stl containers in c++?

673