x

Choose Country Code

x

Direction

x

Ask a Question

  • Ask a Question
  • Scan a Question
  • Post MCQ
  • Note: File extension must be of jpg, jpeg, png, bmp format and file size must not exceed 5 MB
x

Ask a Question

x

x
x
x
Hire a Tutor

Answers and Solutions

What's Your Question?
Answer

#include<iostream.h>

#include<conio.h>

void main() {

int num, rem, sum=0, n;

cout<<"Enter a 3 digit number: ";

cin>>num;

n = num;

 

while(n) {

rem = n % 10;

sum = sum + (rem*rem*rem);

n = n / 10;

}

if(sum == num)

cout<<num<<" is an armstrong number.";

else

cout<<num<<" is not an armstrong number.";

getch();

}

Post Answer and Earn Credit Points

Get 5 credit points for each correct answer. The best one gets 25 in all.

Post Answer