SHARE
TWEET

Untitled

a guest Jan 20th, 2019 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top