Advertisement
stev4

Untitled

Nov 1st, 2019
422
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main(){
  5.  
  6. int n;
  7. int i;
  8. int x;
  9. int cifre;
  10. int y;
  11. int z;
  12.  
  13. for(n=100; n<=999; n++){
  14.  
  15. x=n%10;
  16. y=(n/10)%10; // pomocu ostatka pri deljenju izdvajamo cifru po cifru
  17. z=(n/100)%10;
  18. cifre=pow(x,3)+pow(z,3)+pow(y,3);
  19.  
  20. if(n==cifre){
  21. printf("\n\tArmstrongov broj je %d%d%d\n",z,y,x);
  22. } else;
  23. }
  24.  
  25.  
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement