Computer Science, asked by LoveDose01, 3 months ago

write a C Program to check Armstrong number!

Answers

Answered by balamallikarjun
1

Answer:

jakafss fl ksgsjsbd

Explanation:

i didn't have computer science sub

Answered by pratyush15899
7

Program code:

#include<stdio.h>

int main()

{

int num,copy_of_num,sum=0,rem;

printf("\nEnter a number:");

scanf("%d",&num);

copy_of_num = num;

while (num != 0)

{

rem = num % 10;

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

num = num / 10;

}

if(copy_of_num == sum)

printf("\n%d is an Armstrong Number",copy_of_num);

else

printf("\n%d is not an Armstrong Number",copy_of_num);

return(0);

}

Output:

Enter a number: 370

370 is an Armstrong Number

✌✌

Similar questions