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