+ 1

Why my program is not working. ???

https://code.sololearn.com/cw741q74F5gi/?ref=app Please tell me the mistake I am making !!

14th Mar 2018, 6:52 PM
Aman Jain
Aman Jain - avatar
3 Respuestas
+ 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; }
14th Mar 2018, 6:58 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 11
done
14th Mar 2018, 7:33 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 2
You forgot to put a "printf" in the else clause.
14th Mar 2018, 7:17 PM
Ulisses Cruz
Ulisses Cruz - avatar