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

Does there exist any other function which can be used to convert an integer or a float to a string?

649


What is the use of :: operator in c++?

595


Can I learn c++ as my first language?

605


Explain the concept of memory leak?

622


Can we run c program in turbo c++?

587






What is the v-ptr?

637


What are the advantages of prototyping?

562


What do you mean by stack unwinding in c++?

728


What can I safely assume about the initial values of variables which are not explicitly initialized?

622


Define private, protected and public access control.

604


What are the types of array in c++?

618


Explain deep copy?

606


What does obj stand for?

627


Do the names of parameters have to agree in the prototype, definition, and call to the function?

599


What are the various arithmetic operators in c++?

571