Advertisement
196040

SP Kolokvium 1 Interesen broj

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