Advertisement
hocikto19

4-16

Dec 7th, 2013
404
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.48 KB | None | 0 0
  1. / uloha-4-16.c -- Tyzden 4 - Uloha 16
  2. // Michal Kovacik, 18.10.2013 02:36:23
  3.  
  4. #include <stdio.h>
  5.  
  6. int main()
  7. {
  8.   int n, akt, pred, i;
  9.   scanf("%d", &n);
  10.   scanf("%d", &akt);
  11.   pred=akt;
  12.   if (akt>10 || akt<0)
  13.     printf("Postupnost nie je spravna\n");
  14.   else
  15.     for(i=1; i<n; i++)
  16.     {
  17.       scanf("%d", &akt);
  18.       if (!(akt<=2*pred && akt>=0.5*pred))
  19.         break;
  20.       pred=akt;
  21.     }
  22.   printf("Postupnost %s spravna\n", (i==n)? "je":"nie je");
  23.   return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement