Answer Posted / tapojit roy
#include<stdio.h>
#include<conio.h>
void main()
{
int n,m,x,sum=0;
clrscr();
printf ("the armstrong no. from 0 to 500 are\n");
for (n=1;n<=500;n++){
m=n;
while (m>0)
{
x=m%10;
sum=sum+(x*x*x);
m=m/10;
}
if (sum==n)
{
printf("%d\n",n);
}
sum=0;
}
getch();
}
| Is This Answer Correct ? | 29 Yes | 28 No |
Post New Answer View All Answers
Explain the difference between class and struct in c++?
Explain how would you handle a situation where you cannot call the destructor of a local explicitly?
What is the use of lambda in c++?
Explain what are the sizes and ranges of the basic c++ data types?
What is the use of object in c++?
What is an operator in c++?
What is the auto keyword good for in c++?
What is the array and initializing arrays in c++?
Can we define a constructor as virtual in c++?
How many namespaces are there in c++?
What is private public protected in c++?
What is function overloading c++?
What is friend class in c++ with example?
What are multiple inheritances (virtual inheritance)? What are its advantages and disadvantages?
Write a recursive program to calculate factorial in c++.