Arithmetic Operations Homework Help
+ Addition % Modulus
- Subtraction ++ Increment
* Multiplication -- Decrement
/ Division
{" "}
Increment and Decrement Operators can be post-fixed or pre-fixed. When it is pre-fixed the value is computed before the expression is evaluated, however when it is post-fixed the value is computed after the expression is evaluated.
Following example will explain it more properly:
#include <stdio.h>
int main()
{`
int a,x;
printf("Enter some integer: ");
scanf("%d",&a);
x=a++;
printf("\nx : %d",x);
printf("a : %d",a);
x=a++;
printf("\nx : %d",x);
printf("a : %d",a);
x=++a;
printf("\nx : %d",x);
printf("a : %d",a);
x=++a;
printf("\nx : %d",x);
printf("a : %d",a);
return;
`}
Output of this program is:
Enter some integer: 10
x : 10 a : 11
x : 11 a : 12
x : 13 a : 13
x : 14 a : 14