Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int n, i, c;
- scanf("%d",&n);
- int brojacZaCifri=0;
- int obratenBroj, max = 0;
- if(n>9)
- {
- for (i =9; i <n; i++)
- {
- int temp = i;
- obratenBroj = 0;
- brojacZaCifri=0;
- while (temp > 0)
- {
- c = temp % 10;
- obratenBroj = 10*obratenBroj + c;
- brojacZaCifri++;
- temp /= 10;
- }
- if (obratenBroj % brojacZaCifri == 0)
- {
- if (i > max) { max = i; }
- }
- }
- printf("%d", max);
- }
- else
- {
- printf("Brojot ne e validen\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment