Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
Lab 6 v1
//gcc 5.4.0 //int n; //int d; //READ n //int nn=n; //int sum=0; //WHILE (n>0){ // d=n%10; // sum+=(d*d*d); // n=n/10; //} //if n=sum // PRINT nn is an armstrong number //if n!=sum // PRINT nn is not an armstrong number #include <stdio.h> int main(void) { int n; int d; scanf("%d",&n); int nn=n; int sum=0; //printf("%d\n",nn); while(n>0){ d=n%10; sum+=(d*d*d); n=n/10; } // printf("%d\n",nn); if(nn==sum) printf("%d is an armstrong number!",nn); if(nn!=sum) printf("%d isn't an armstrong number :(",nn); }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
printf
A_141121_mayorMenor
Lab 7 blackjack v0.1
150109_RecursividadFactorial
htabprepa
A_141205_ContadorPalabras
FUNTION4
Incometax problem v0.1
22nd HW Switchv0.3
Assignment 4
stackse - search stackoverflow differently
Please log in to post a comment.