tyrion

positivo.c

Feb 9th, 2012
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.29 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdbool.h>
  3.  
  4. bool positivo(int array[], int length) {
  5.     for (int i = 0; i < length; ++i) {
  6.         if (array[i] < 0)
  7.             return false;
  8.     }
  9.     return true;
  10. }
  11.  
  12. int main() {
  13.     int test[] = {1, 2, 3, -8, 5};
  14.     printf("%d\n", positivo(test, 5));
  15. }
Advertisement
Add Comment
Please, Sign In to add comment