My issue
include <stdio.h>
int main() {
// your code goes here
int num, rem, sum=0;
scanf(“%d”, &num);
int temp=num;
while(num!=0)
{
rem=num%10;
sum=sum+(remremrem);
num=num/10;
}
int result=sum;
if (result==temp)
{
printf(“Armstrong”);
}
else {
printf(“Not Armstrong”);
}
return 0;
}
what is the error here.
My code
#include <stdio.h>
int main() {
// your code goes here
int num, rem, sum=0;
scanf("%d", &num);
int temp=num;
while(num!=0)
{
rem=num%10;
sum=sum+(rem*rem*rem);
num=num/10;
}
int result=sum;
if (result==temp)
{
printf("Armstrong");
}
else {
printf("Not Armstrong");
}
return 0;
}
Learning course: Algorithmic Problem Solving
Problem Link: https://www.codechef.com/learn/course/klu-problem-solving/KLUPS00A/problems/LPYAS151