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

Explain the pure virtual functions?

1074


What are the different types of polymorphism in c++?

1097


What is encapsulation in C++? Give an example.

1055


I want to write a C++ language program that: 1. Reads in the size of a square from the screen; 2. Prints a hollow square of that size out of “-“, “|” and blanks on screen; 3. Prints the same hollow square onto a text file. The program should work for squares of all side sizes between 1 and 20.

2765


What is rvalue?

1107


What do you mean by public protected and private in c++?

1023


How we can differentiate between a pre and post increment operators during overloading?

1070


Explain explicit container.

1053


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

1077


Can c++ do everything c can?

1026


Explain storage qualifiers in c++.

1057


Are iterators pointers?

1118


Will a C compiler always compile C++ code a) Yes b) No c) Only optimized compilers

1020


What is a local reference?

1160


What are shallow and deep copy?

1078