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 / sarang deshpande

#include<iostream.h>
#include<conio.h>
void main()
{
int n,n1,sum,rem;
clrscr();
cout<<" \n Enter a num ";
cin>>n;
n1=n;
sum=0;
while(n>0)
{
rem=n%10;
sum=sum+(rem*rem*rem);
n=n/10;
}
if(n1==sum)
{
cout<<"\n The number is armstrong "<<n1;
}
else
{
cout<<"\n The number is not armstrong "<<n1;
}
getch();
}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is name hiding in c++?

1174


What is guard code in c++?

1184


Write a program that takes a 5 digit number and calculates 2 power that number and prints it.

2588


Explain the auto storage classes in c++.

1117


What is namespace & why it is used in c++?

1137


What is unary operator? List out the different operators involved in the unary operator.

1016


Is C++ case sensitive a) False b) Depends on implementation c) True

1098


What is the size of a vector?

1165


Is it possible to write a c++ template to check for a function's existence?

1043


what are the iterator and generic algorithms.

1983


What are guid? Why does com need guids?

1073


Can we make any program in c++ without using any header file and what is the shortest program in c++.

1145


Can we make copy constructor private in c++?

1072


Define a constructor - what it is and how it might be called (2 methods)?

1163


How do you instruct your compiler to print the contents of the intermediate file showing the effects of the preprocessor?

1159