Computer Science, asked by assassinaasim22, 6 months ago

please do it.......,....​

Attachments:

Answers

Answered by CoderRishav
1

Answer:

if n is 1

a = 2

b = 0

if n is 0

a = 1

b = 1

Explanation:

It's easy because if n is one then 1 is greater than 0 so the value of a is increses by 1 and b will decrease by 1 so a = 2,b = 0

if n is 0 then condition will be false and the statement under if will not work

please vote and give brainlist :)

Answered by anindyaadhikari13
19

Answer:-

Given code,

int A=1,B=1,N;

if(N>0)

A=A+1;

A=B-1;

If the value of n is 1 then if part will execute,

So,

A=A+1

Or,

A=2

Now,

A=B-1

Or,

A=0

Now, if the value of n is 0 then if part will not execute,

So,

A=B-1

Or,

A=0

Answer:-

  1. If N=0, A=0,B=1
  2. If N=0, A=0, B=1
Similar questions