Advertisement
Guest User

Untitled

a guest
Dec 26th, 2014
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1.  
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. int strogo_rastuci(int* p1, int *p2)
  6. {
  7.  
  8. int i,c;
  9. i=0;
  10.  
  11. c=0;
  12. if (p1>p2)return 0;
  13. for(i=0; i<p2-p1; i++)
  14. {
  15.  
  16. if((*p1+i)>=(*(p1+i+1)))return c;
  17. }
  18. return 1;
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29. }
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44. int main()
  45. {
  46. int i,n,niz[100],p1,p2,t;
  47. printf("Unesite broj clanova niza: ");
  48. scanf("%d",&n);
  49. if(n<0||n>100)
  50. {
  51. printf("NEISTINA");
  52. return 0;
  53. };
  54. printf("Unesite clanove niza: ");
  55. for(i=0; i<n; i++)
  56. {
  57. scanf("%d",&niz[i]);
  58.  
  59.  
  60. }
  61. printf("Unesite indeks za p1: ");
  62. scanf("%d",&p1);
  63. if(p1<0||p1>n)
  64. {
  65. printf("NEISTINA");
  66. return 0;
  67. };
  68. printf("Unesite indeks za p2: ");
  69. scanf("%d",&p2);
  70. if(p1>p2||p2>n||p2<0)
  71. {
  72. printf("NEISTINA");
  73. return 0;
  74. };
  75. t=strogo_rastuci(&niz[p1],&niz[p2]);
  76. if(t==1)printf("ISTINA");
  77. else printf("NEISTINA");
  78.  
  79.  
  80.  
  81.  
  82.  
  83. return 0;
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement