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