+ 1
Why my program is not working. ???
https://code.sololearn.com/cw741q74F5gi/?ref=app Please tell me the mistake I am making !!
4 Respostas
+ 13
//corrected 👍
//U changed value of n ... so didn't got matched with m
#include <stdio.h>
int main()
{
int k,n,r,m=0;
printf("Enter a three digit number");
scanf("%d",&k);
n=k;
while(n!=0)
{
r=n%10;
m=m+r*r*r;
n=n/10;
}
if(m==k)
printf("%d is an Armstrong number",m);
else printf("Not an Armstrong Number"); //edited
return 0;
}
+ 11
done
+ 2
You forgot to put a "printf" in the else clause.