Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.24 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. char is_positive(int i)
  4. {
  5.     if(i < 0)
  6.         return '-';
  7.     else
  8.         return '+';
  9. }
  10.  
  11. int main(void)
  12. {
  13.     int x;
  14.     int z;
  15.    
  16.     printf("Podaj liczbe: ");
  17.     scanf("%d", &x);
  18.     z = is_positive(x);
  19.     printf("Podana liczba ma znak: %c", z);
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement