Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #define EPS 1e+9
- int main()
- {
- int n, br=0, c, st=1, s=0, i, pom, j;
- do{
- printf("Unesite broj n:"); scanf("%d", &n);
- } while (n>EPS);
- for (j=10; j<=n; j++)
- {
- pom=j;
- br=0;
- s=0;
- while (pom>0)
- {
- pom/=10;
- br++;
- }
- pom=j;
- while (pom)
- {
- c=pom %10;
- for (i=1, st=1; i<=br; i++){
- st*=c;
- }
- s+=st;
- pom=pom/10;
- }
- if (s==j)
- printf("%d\n", j);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement