Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- void is_positive(int num); // Checa se número é positivo ou não.
- int main(void)
- {
- int i;
- for(i = 3; i >= -3; i--)
- {
- is_positive(i);
- }
- putchar('\n');
- }
- void is_positive(int num)
- {
- char valor[9];
- if(num > 0)
- strcpy(valor, "positivo");
- else if(num < 0)
- strcpy(valor, "negativo");
- else
- strcpy(valor, "nulo");
- printf("\nO numero %d e %s\n", num, valor);
- }
Add Comment
Please, Sign In to add comment