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

How does class accomplish data hiding in c++?

657


What is meaning of in c++?

668


Who was the creator of c++?

556


Declare a class vehicle and make it an abstract data type.

533


What is the default access level?

619






What return value must conversion operators have in their declaration?

610


What are the main features of c++?

540


Why do we use constructor?

595


Write a program for Divide a number with 2 and Print the output ( NOTE: Check for divide by zero error).

629


How do you define/declare constants in c++?

604


Is c++ still in demand?

632


What is oop in c++?

597


What is a binary file? List the merits and demerits of the binary file usagein C++.

728


How do you clear a buffer in c++?

535


If there are two catch statements, one for base and one for derived, which should come first?

569