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
Explain the pure virtual functions?
What are the different types of polymorphism in c++?
What is encapsulation in C++? Give an example.
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.
What is rvalue?
What do you mean by public protected and private in c++?
How we can differentiate between a pre and post increment operators during overloading?
Explain explicit container.
Write a program for Divide a number with 2 and Print the output ( NOTE: Check for divide by zero error).
Can c++ do everything c can?
Explain storage qualifiers in c++.
Are iterators pointers?
Will a C compiler always compile C++ code a) Yes b) No c) Only optimized compilers
What is a local reference?
What are shallow and deep copy?