SHARE
TWEET

Increment and Decrement Operators

Tahamina_Taha Aug 17th, 2019 (edited) 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>
  2. #include<math.h>
  3. // All  prefix and postfix (increment,decrement) operators
  4. int main()
  5. {
  6.     int a,b;
  7.     float c,d;
  8.     printf(" Enter  integer values of a,b: \n");
  9.     scanf("%d %d",&a,&b);
  10.     printf("Enter float values of c,d: \n");
  11.     scanf("%f %f",&c,&d);
  12.  
  13.     printf("++a = %d \n", ++a);//for prefix increment
  14.     printf("--b = %d \n", --b);//for prefix decrement
  15.     printf("++c = %f \n", ++c);//for prefix increment
  16.     printf("--d = %f \n", --d);//for prefix decrement
  17.  
  18.     printf("a++ = %d \n", a++);//for postfix increment
  19.     printf("b-- = %d \n", b--);//for postfix decrement
  20.     printf("c++ = %f \n", c++);//for postfix increment
  21.     printf("d-- = %f \n", d--);//for postfix decrement
  22.  
  23.      return 0;
  24.      }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top