Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <ctype.h>
- #include <string.h>
- #include <math.h>
- int maksCifra(int broj) {
- if(broj < 10) {
- return broj;
- }
- int cifra = broj % 10;
- int maks = maksCifra(broj / 10);
- if(cifra > maks) {
- return cifra;
- }
- else {
- return maks;
- }
- }
- int main() {
- printf("%d\n", maksCifra(897));
- return 0;
- }
- /*
- maksCifra(897) = maximum(7, 9) = 9
- maksCifra(89) = max(9, 8) = 9
- maksCifra(8) = 8
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement