Advertisement
Tahamina_Taha

unary operators

Feb 5th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.49 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<math.h>
  3. // All   unary operators
  4. int main()
  5. {
  6.     /* The minus operator changes the sign of its argument.
  7.     A positive number becomes negative,
  8.      and a negative number becomes positive. */
  9.     int a,b,result;
  10.     printf(" Enter value of a: \n");
  11.     scanf("%d",&a);
  12.     result= -a;
  13.     printf("a: %d\n",result);
  14.  
  15.     printf(" value of b: \n");
  16.     scanf("%d",&b);
  17.     result = +b;//useless huh
  18.     printf("b : %d",result);
  19.      return 0;
  20.      }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement