Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int podniz(int niz[], int n) {
- int trenutni = 0;
- int max = trenutni;
- for (int i = 0; i < n; i++)
- {
- if (niz[i] % 2 == 1) {
- trenutni++;
- }
- else {
- trenutni = 0;
- }
- if (trenutni > max) {
- max = trenutni;
- }
- }
- return max;
- }
- int main(void) {
- int niz[11] = { 1,2,2,3,3,5,4,3,78,6,5 };
- int brEl = 11;
- int brojNajduzegPodnizaNeparnih = podniz(niz, brEl);
- printf("%d", brojNajduzegPodnizaNeparnih);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement