w a p to check the number whether it is armstrong or not(iterative construct)
Answers
Answered by
1
Answer:
sorry bhi I don't no
Answered by
1
Answer:
#include <stdio.h>
int main()
{
int num, originalNum, remainder, result = 0;
printf("Enter a three-digit integer: ");
scanf("%d", &num);
originalNum = num;
while (originalNum != 0) {
// remainder contains the last digit
remainder = originalNum % 10;
result += remainder * remainder * remainder;
// removing last digit from the orignal number
originalNum /= 10;
}
if (result == num)
printf("%d is an Armstrong number.", num);
else
printf("%d is not an Armstrong number.", num);
return 0;
}
Explanation:
Output
Enter a three-digit integer: 371
371 is an Armstrong number.
Similar questions
Math,
4 months ago
Social Sciences,
4 months ago
Chemistry,
4 months ago
English,
9 months ago
Science,
9 months ago