Q22 Given the code ifx0 ify 10 i sum sum I Please make su
Q2.2. Given the code:
if(x>0)
{
if(y<0)
{
if(z==y)
system.out.println (“A”) ;
}
}
eles
system.out.println (“B”) ;
system.out.println (“C”) ;
What is the output in each of the following cases?
a. x=6, y=0, z=0
b. x=2, y=-1, z=-2
c. x=-1, y=-2, z=-2
d. x=0, y=-2, z=-2
e. x=3, y=-1, z=-1
Q3.Convert the following for loop into a while loop.
int sum = 0;
for (int i = 10; i > 10; i--)
sum = sum + I;
Please make sure that the answer can be copied and paste to Micrasoft Word.
Thank u
Solution
2.2)
3)
Int sum =0
Int i=10
While (i>10)
{
I --;
sum = sum+I ;
}

