Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int rekurzija(int *niza, int i, int n) {
- if(i == n - 1) {
- return niza[i];
- }
- if(rekurzija(niza, i + 1, n) < niza[i]) {
- return niza[i];
- }
- return rekurzija(niza, i + 1, n);
- }
- int main() {
- int n;
- scanf("%d", &n);
- int niza[n];
- for(int i = 0; i < n; i++) {
- scanf("%d", &niza[i]);
- }
- printf("%d\n", rekurzija(niza, 0, n));
- return 0;
- }
- // 7 3 7 15 1 292 1 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement