Write the program form Armstrong no in c++?

Answer Posted / vinay k bharadwaj

dear frd your ans is wrong.


#include<stdio.h>
#include<conio.h>
void main()
{
int sum=0,n,m,x;
clrscr();
scanf("%d",&n);
m=n;
while(n>0)
{
x=n%10;
n=n/10;
sum=sum+(x*x*x);
}
if(sum==m)
printf("number is armstrong");
else
printf("number is not armstrong");
getch();
}

Is This Answer Correct ?    87 Yes 47 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the differences between private, public and protected and give examples.

653


Which is not a valid keyword a) public b) protected c) guarded

855


What does catch(…) mean?

722


What is the full form of c++?

717


What is the use of "new" operator?

761






Explain the use of this pointer?

740


What is a tree in c++?

637


What is data binding in c++?

596


Explain the difference between overloading and overriding?

725


What are the differences between new and malloc?

718


Why c++ is faster than java?

705


What is searching? Explain linear and binary search.

668


What is a rooted hierarchy?

771


What is abstraction in c++?

769


What is virtual base class?

665