Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main (int argc, const char * argv[]) {
- int a, b;
- scanf("%d%d", &a, &b);
- for(int i = a; i <= b; i++) {
- int prevrten = 0;
- for(int x = i; x > 0; x /= 10) {
- int cifra = x % 10;
- prevrten = (prevrten * 10) + cifra;
- }
- int zbir = 0;
- for(int j = 1; j < prevrten; j++) {
- if(prevrten % j == 0) {
- zbir += j;
- }
- }
- if(prevrten == zbir) {
- printf("%d ", i);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement