( ノ ゚ー゚)ノPREFIX POSTFIX OPERATOR PRACTISE QUESTIONS\(゚ー゚\)
________________________________________________________
sorry for the previous questions where the docs and img werent proper
this time ill just send it in text
________________________________________________________
1.int a=7;
int z= a++ + a – – ;
2.int a = 5;
int z = - -a + ++a ;
3. int a= 6;
int z= a++ + ++a
4. int a = 4;
z= a-- + ++a – a++;
5. int a= 5;
int m= a++ + a – -;
6. class PrePostDemo {
public static void main(String[] args){
int i = 3;
i++;
System.out.println(i);
++i;
System.out.println(i);
System.out.println(++i);
System.out.println(i++);
System.out.println(i); }}
7. int i = 5;
int j = ++i;
System.out.println("j="+j);
System.out.println("i="+i);
8.int i = 5;
int j = i++;
System.out.println("j="+j);
System.out.println("i="+i);
9. int a = 5
++a;
a++;
--a;
a--;
System.out.println(a);
10 . int a = 34;
int b = 21;
int c = a++ + ++b;
int d = --a + --b + c--;
int sum = a + b + c + d ;
System.out.println("sum = " + sum);
11.
i)System.out.println(2+7%3);
ii)System.out.println(2>3&&4<5);
iii)System.out.println((2>3||4<5);
iv)System.out.printn(!(7= =8);
________________________________________________________
Answers
Answered by
1
Answer:
1. z = 15
2. z = 9
3. z = 14
4. z = 4
5. z = 11
6. output : 4 5 6 6 7
7. output: "error: string and int type addition"
8. output: "error: string and int type addition"
9. output: 5
10. output: "error: string and int type addition"
11. output:
i) 3
ii) false (0)
iii) true (1)
iv) true (1)
Like and Mark as Brainliest, it really motivates!
Similar questions