May 26, 2023
program to use postfix Increment and decrement in c language
#include<stdio.h>
int main()
{
int s=10;
printf("s=%d\t",s);
printf("s=%d\t",s++);
printf("s=%d\t",s);
printf("s=%d\t",s--);
printf("s=%d\n",s);
return 0;
}
output
s=10 s=10 s=11 s=11 s=10
Steps Description
- Declare integer variable
S=10
- Initialize in integer variable
S=10
printf
inbuild function to display value of variableS
in decimal place holder %dS = 10
for formatting tab separator \t is usedprintf
inbuild function to display postfix increment values variableS
in decimal
place holder %dS = 10
for formatting tab separator \t is usedprintf
inbuild function to display value of variableS
in decimal place holder %dS = 11
for formatting tab separator \t is usedprintf
inbuild function to display post decrement values variableS
in decimal place holder %dS = 11
for formatting tab separator \t is usedprintf
inbuild function to display value of variableS
in decimal place holder %dS = 10
for formatting tab separator \t is used
by : Ajaj Khan
Quick Summary:
use postfix Increment and decrement in c language