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 |
What is c++ & why it is used?
How long does it take to get good at leetcode?
Can a list of string be stored within a two dimensional array?
What is implicit pointer in c++?
What does it mean to declare a member function as static?
What C++ libraries are you proficient with?
Why do we use vector in c++?
What is the extraction operator and what does it do?
What is #include sstream?
How do you find out if a linked-list has an end? (I.e. The list is not a cycle)
How many ways are there to initialize an int with a constant?
How to construct virtual constructor
6 Answers CIStems Software, Symphony,