QUESTION DESCRIPTION :
Write a program to scan the given input and perform unary prefix increment and decrement operators.
Condition :
Variable name to be used:
Preadd, Presub, Posadd, Possub
Input and Output Format:
Refer sample input and output for formatting specification.
All float values are displayed correct to 2 decimal places.
All text in bold corresponds to input and the rest corresponds to output.
TEST CASE 1
INPUT
1
OUTPUT
2
1
1
2
EXPLANATION :
The objective of the code is to receive an integer input form the user and print the pre-increment , pre-decrement , post-increment , post-decrement values of the input received from the user. (Increment and Decrement Operators)
ALGORITHM :
SOLUTION : (Please use this as reference only)
Write a program to scan the given input and perform unary prefix increment and decrement operators.
Condition :
Variable name to be used:
Preadd, Presub, Posadd, Possub
Input and Output Format:
Refer sample input and output for formatting specification.
All float values are displayed correct to 2 decimal places.
All text in bold corresponds to input and the rest corresponds to output.
TEST CASE 1
INPUT
1
OUTPUT
2
1
1
2
EXPLANATION :
The objective of the code is to receive an integer input form the user and print the pre-increment , pre-decrement , post-increment , post-decrement values of the input received from the user. (Increment and Decrement Operators)
ALGORITHM :
- Take an input from the user ( a )
- Take pre increment of the value ( ++a )
- Take pre decrement of the value ( --a )
- Take post increment of the value ( a++ )
- Take ppst decrement of the value ( a-- )
- Store them in the variables and print ( Preadd,Presub,Posadd,Possub )
SOLUTION : (Please use this as reference only)
CODE |
No comments:
Post a Comment