Guest User

Untitled

a guest
Jan 20th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. void is_positive(int num); // Checa se número é positivo ou não.
  5.  
  6. int main(void)
  7. {
  8. int i;
  9. for(i = 3; i >= -3; i--)
  10. {
  11. is_positive(i);
  12. }
  13.  
  14. putchar('\n');
  15. }
  16.  
  17. void is_positive(int num)
  18. {
  19. char valor[9];
  20.  
  21. if(num > 0)
  22. strcpy(valor, "positivo");
  23. else if(num < 0)
  24. strcpy(valor, "negativo");
  25. else
  26. strcpy(valor, "nulo");
  27.  
  28. printf("\nO numero %d e %s\n", num, valor);
  29. }
Add Comment
Please, Sign In to add comment