Write the program form Armstrong no in c++?
Answers were Sorted based on User's Feedback
Answer / ankit,rohit
#include<stdio.h>
#include<conio.h>
void main()
{
int sum=0,n,m,i;
clrscr();
scanf("%d",&i);
n=i;
m=n;
while(n>0)
{
m=n%10;
sum=sum+(m*m*m);
n=n/10;
}
if(i==sum)
{
printf("the given number is amstrong");
else
printf("the given number is not amstrong");
}
getch();
}
| Is This Answer Correct ? | 20 Yes | 22 No |
Why is polymorphism useful?
write a C++ programming :if the no is between 32 to 50 it will be odd.
Explain the volatile and mutable keywords.
Write a program to get the value of sin (x) using a library function , when x is given in degrees.
template<class T, class X> class Obj { T my_t; X my_x; public: Obj(T t, X x) : my_t(t), my_x(x) { } }; Referring to the sample code above, which one of the following is a valid conversion operator for the type T? a) T operator T () { return my_t; } b) T operator(T) const { return my_t; } c) operator(T) { return my_t; } d) T operator T (const Obj &obj) { return obj.my_t; } e) operator T () const { return my_t; }
What is the disadvantage of using a macro?
In a function declaration what does extern means?
what is the size of a class which contains no member variables but has two objects??? is it 1 or 2??
How would you use the functions sin(), pow(), sqrt()?
Describe exception handling concept with an example?
What is private inheritance?
What is the most useful programming language?