Advertisement
Guest User

Untitled

a guest
Nov 28th, 2015
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #define EPS 1e+9
  4.  
  5. int main()
  6. {
  7. int n, br=0, c, st=1, s=0, i, pom, j;
  8. do{
  9. printf("Unesite broj n:"); scanf("%d", &n);
  10. } while (n>EPS);
  11.  
  12. for (j=10; j<=n; j++)
  13. {
  14. pom=j;
  15. br=0;
  16. s=0;
  17. while (pom>0)
  18. {
  19. pom/=10;
  20. br++;
  21. }
  22. pom=j;
  23. while (pom)
  24. {
  25. c=pom %10;
  26. for (i=1, st=1; i<=br; i++){
  27. st*=c;
  28. }
  29. s+=st;
  30. pom=pom/10;
  31. }
  32. if (s==j)
  33. printf("%d\n", j);
  34. }
  35. return 0;
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement