Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Write the program form Armstrong no in c++?

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


Please Help Members By Posting Answers For Below Questions

Explain the difference between class and struct in c++?

985


Explain how would you handle a situation where you cannot call the destructor of a local explicitly?

912


What is the use of lambda in c++?

966


Explain what are the sizes and ranges of the basic c++ data types?

1111


What is the use of object in c++?

1049


What is an operator in c++?

995


What is the auto keyword good for in c++?

1118


What is the array and initializing arrays in c++?

982


Can we define a constructor as virtual in c++?

1064


How many namespaces are there in c++?

1010


What is private public protected in c++?

981


What is function overloading c++?

1021


What is friend class in c++ with example?

945


What are multiple inheritances (virtual inheritance)? What are its advantages and disadvantages?

994


Write a recursive program to calculate factorial in c++.

1025