Write the program form Armstrong no in c++?

Answers were Sorted based on User's Feedback



Write the program form Armstrong no in c++?..

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

Post New Answer

More C++ General Interview Questions

What is c++ & why it is used?

0 Answers  


How long does it take to get good at leetcode?

0 Answers  


Can a list of string be stored within a two dimensional array?

0 Answers  


What is implicit pointer in c++?

0 Answers  


What does it mean to declare a member function as static?

0 Answers  






What C++ libraries are you proficient with?

1 Answers   Google,


Why do we use vector in c++?

0 Answers  


What is the extraction operator and what does it do?

0 Answers  


What is #include sstream?

0 Answers  


How do you find out if a linked-list has an end? (I.e. The list is not a cycle)

0 Answers  


How many ways are there to initialize an int with a constant?

1 Answers  


How to construct virtual constructor

6 Answers   CIStems Software, Symphony,


Categories