Write the program form Armstrong no in c++?

Answers were Sorted based on User's Feedback



Write the program form Armstrong no in c++?..

Answer / ankit,rohit

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

Is This Answer Correct ?    20 Yes 22 No

Post New Answer

More C++ General Interview Questions

What is & in c++ function?

0 Answers  


What are the debugging methods you use when came across a problem?

1 Answers  


Who calls main function?

0 Answers  


What is microsoft c++ redistributable?

0 Answers  


State the difference between pre and post increment/decrement operations.

0 Answers  






What is nested class in c++?

0 Answers  


When do we use copy constructors?

0 Answers  


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

0 Answers  


Explain selection sorting. Also write an example.

0 Answers  


What is difference between class and structure in c++?

0 Answers  


What do you mean by function and operator overloading in c++?

0 Answers  


What is functions syntax in c++?

0 Answers  


Categories