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