Write the program form Armstrong no in c++?

Answer Posted / astitva srivastava

#include<iostream.h>
#include<conio.h>
void main()
{
int n,r,s=0;
cout<<"enter the no.";
cin>>n;
int b=n;
while(n>0)
{
r=n%10;
n=n/10;
s=s+(r*r*r);
}
if(b==s)
{
cout<<"the no. is armstrong"<<"\n";
}
else
{
cout<<"the no. is not a armstrong no.";
}
}

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you mean by translation unit in c++?

798


What is new in c++?

670


Explain the pure virtual functions?

726


What is const in c++?

672


Can we make any program in c++ without using any header file and what is the shortest program in c++.

713






What is the difference between c++ and turbo c++?

678


How the keyword struct is different from the keyword class in c++?

678


Why we use #include conio h in c++?

692


Is c++ a low level language?

605


Explain how an exception handler is defined and invoked in a Program.

695


Can we delete this pointer in c++?

789


What is a forward referencing and when should it be used?

673


What is called array?

688


Why isn't sizeof for a struct equal to the sum of sizeof of each member?

625


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

3296