Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int suma_na_cifri(int broj) {
- if(broj == 0) {
- return 0;
- }
- int cifra = broj % 10;
- int dodadi = 0;
- if(cifra % 2 == 1) {
- dodadi = cifra;
- }
- return suma_na_cifri(broj / 10) + dodadi;
- }
- void rekurzija(int a, int b) {
- if(a > b) {
- return;
- }
- int sum = suma_na_cifri(a);
- if(sum != 0 && sum % 5 == 0) {
- printf("%d ", a);
- }
- rekurzija(a + 1, b);
- }
- int main(){
- int A, B;
- scanf("%d%d", &A, &B);
- rekurzija(A, B);
- return 0;
- }
- /*
- **/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement