Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #define true 1
- #define false 0
- int strogo_rastuci(int p1, int p2)
- {
- int a[100], i, x;
- for(i=p1; i<p2; i++)
- {
- if(a[i]<a[i+1]) x=true;
- else x=false;
- }
- if(p1>p2) x=false;
- if(p1==p2) x=true;
- return x;
- }
- int main()
- {
- int n, a[100], i, p1, p2;
- printf("Unesite broj clanova niza: ");
- scanf("%d", &n);
- if(n<0 || n>=100)
- {
- printf("Pogresan unos");
- return 0;
- }
- for(i=0; i<n; i++)
- printf("Unesite clanove niza: ");
- {
- scanf("%d", &a[i]);
- }
- printf("Unesite indeks za p1: ");
- scanf("%d", &p1);
- if(p1<0 || p1>=n)
- {
- printf("Pogresan unos");
- return 0;
- }
- printf("Unesite indeks za p2: ");
- scanf("%d", &p2);
- if(p2<0 || p2>=n)
- {
- printf("Pogresan unos");
- return 0;
- }
- if(strogo_rastuci(p1, p2)==true) printf("ISTINA");
- if(strogo_rastuci(p1, p2)==false) printf("NEISTINA");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement