Write a program to scan the given input and perform unary prefix increment and decrement operators. Condition : Variable name to be used: Preadd, Presub, Postadd, Postsub Perform the following operations: 1. Preadd = ++a 2. Presub = --a 3. Postadd =a++ 4. Postsub =a-- Test Case 1 Input (stdin) 2 Expected Output 3 2 2 3 Test Case 2 Input (stdin) 7 Expected Output 8 7 7 8
#include <stdio.h>
int main()
{
int inp=0;
scanf ("%d",&inp);
printf ("%d",++inp);
printf ("\n%d",--inp);
printf ("\n%d",inp++);
printf ("\n%d",inp--);
return 0;
}