Advertisement
Guest User

Untitled

a guest
Nov 20th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main () {
  4. int n,x,i,brojac=0,cifra,broj=0;
  5. scanf("%d",&n);
  6. if(n<10) {
  7. printf("Brojot ne e validen");
  8. return 0;
  9. }
  10. for(i=(n-1); i>0; i--) {
  11. x=i;
  12. while(x) {
  13. cifra=x%10;
  14. brojac++;
  15. broj=broj*10+cifra;
  16. x/=10;
  17. }
  18. if(broj%brojac==0) {
  19. printf("%d",i);
  20. return 0;
  21. }
  22. broj=0;
  23. brojac=0;
  24. }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement