My issue
solve the problem
My code
#include <stdio.h>
int main() {
int num, originalNum, remainder, result = 0;
printf("Enter a three-digit integer: ");
scanf("%d", &num);
// Check if the number is three digits
if (num < 100 || num > 999) {
printf("%d is not a three-digit number.\n", num);
return 1; // Exit if the number is not three digits
}
originalNum = num;
// Calculate the sum of the cubes of its digits
while (originalNum != 0) {
remainder = originalNum % 10;
result += remainder * remainder * remainder;
originalNum /= 10;
}
// Check if the result is equal to the original number
if (result == num)
printf("%d is an Armstrong number.\n", num);
else
printf("%d is not an Armstrong number.\n", num);
return 0;
}
Learning course: Algorithmic Problem Solving
Problem Link: https://www.codechef.com/learn/course/klu-problem-solving/KLUPS00A/problems/LPYAS151