Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- #include <math.h>
- int funkcija(int *niza, int n) {
- int S = niza[0], E = niza[n - 1];
- if(S > E) {
- S = niza[n - 1];
- E = niza[0];
- }
- int brojac = 0;
- for(int i = 1; i < n - 1; i++) {
- if(niza[i] < S || niza[i] > E) {
- brojac++;
- }
- }
- return brojac;
- }
- int main(int argc, char * argv[]) {
- int n;
- scanf("%d", &n);
- int niza[n];
- for(int i = 0; i < n; i++) {
- scanf("%d", &niza[i]);
- }
- int res = funkcija(niza, n);
- printf("%d\n", res);
- }
- /*
- 9
- 1 7 0 2 5 0 0 4
- **/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement