Computer Science, asked by getmezubair43, 4 months ago

predict the output of the given snippet, when executed
int a=1 ,b=1 ,m=10 ,n=5;
if ((a==1)&&(b==0))
{
system.out.println((m+n));
system.out.println((m-n));
}
if((a==1)%%(b==1))
{
system.out.println((m*n));
system.outprintln((m%n));
}

Answers

Answered by atrs7391
1

Given Program:

int a=1 ,b=1 ,m=10 ,n=5;

if ((a==1)&&(b==0))

{

system.out.println((m+n));

system.out.println((m-n));

}

if((a==1)%%(b==1))

{

system.out.println((m*n));

system.outprintln((m%n));

}

Rectified Program:

int a=1 ,b=1 ,m=10 ,n=5;

if ((a==1)&&(b==0))

{

System.out.println((m+n));

System.out.println((m-n));

}

if((a==1)&&(b==1))

{

System.out.println((m*n));

System.out.println((m%n));

}

Output of Rectified Program:

50

0

The given program was incorrect so I rectified it and then gave the output.

Similar questions