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

Is c++ proprietary?

578


What are literals in C++?

593


Who discovered c++?

558


Carry out conversion of one object of user-defined type to another?

607


What is a singleton c++?

549






what are the iterator and generic algorithms.

1459


What is extern c++?

520


What is the best free c++ compiler for windows?

588


What are the two main components of c++?

588


What are files in c++?

589


Can char be a number c++?

589


How can a struct in c++ differs from a struct in c?

610


What is :: operator in c++?

580


How does list r; differs from list r();?

687


What is the difference between cin.read() and cin.getline()?

555