Advertisement
BlueBear

postupnost.c

Mar 25th, 2014
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(void)
  4. {
  5.     int n, i, pred, cislo, je = 1;
  6.  
  7.     scanf("%d", &n);
  8.     if (n >= 0 && n <= 10)
  9.     {
  10.         for (i = 0; i < n; i++)
  11.         {
  12.             scanf("\n%d",&cislo);
  13.             if (i == 0)
  14.                 pred = cislo;
  15.             else
  16.                 if ((cislo > (2*pred)) || (cislo < (pred/2)))
  17.                     je = 0;
  18.         }
  19.         if (je == 0)
  20.             printf("Postupnost je nespravna\n");
  21.         else
  22.             printf("Postupnost je spravna\n");
  23.     }
  24.     else
  25.         return 1;
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement