Unary & Ternary Based Programs
1. If m=7 & n=9 then what will be the Output : m*=++n;
2. If m=8 & n=9 then what will be the Output : m = n++ * (++m
+ n++);
3. If a=3 then what will be the Output : a+=++a + a++ +
a;
4. If a=15, c=4 then what
will be the result of s = a++ + ++a*c++
- c.
5. If a=12, b=20, c=10 then what will be the result of a = a - b++ * ++a +
a++ * b++.
6. If a=13, b=21, c=10 then what will be the result of a = ++a * ++b / ++c;
7. If a=5, b=6 then what will be the output of a+= a++ - ++b * ++a + b++;
8. Give the output of the program snippet:
int
m = 8, n = 15;
if(m >= 10)
m-=m--*n;
else
m+=++m*n++;
System.out.println("m = " + m + " and n = " + n);
9. Rewrite the following using ternary operator:
if(income <= 100000)
tax = (amt*0.10);
else
tax = (0.30 * income);
10. Rewrite the following using if-else:
a=(amt<100)?u*10: 0;
👍
ReplyDeleteMast tha sir😎😍
ReplyDelete