ivana_andreevska

Zadaca za vtor kolokvium/ispit 2

May 23rd, 2021
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.52 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4.  
  5. int sumaParoviCifriPodogolemiOd(int n,int broj)
  6. {
  7.     if(n==0)
  8.         return 0;
  9.     else{
  10.         int par=n%100;
  11.         if(par<=broj)
  12.         {
  13.         return sumaParoviCifriPodogolemiOd(n/100,broj);
  14.         }
  15.         else{
  16.         return par+sumaParoviCifriPodogolemiOd(n/100,broj);
  17.         }
  18.     }
  19. }
  20.  
  21. int main()
  22. {
  23.     int n;
  24.     int broj;
  25.     scanf("%d%d",&n,&broj);
  26.     printf("%d", sumaParoviCifriPodogolemiOd(n,broj));
  27.     return 0;
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment