Computer Science, asked by SƬᏗᏒᏇᏗƦƦᎥᎧƦ, 7 months ago

Please solve these questions
and no spam ​

Attachments:

Answers

Answered by anindyaadhikari13
2

Question:-

Perform calculation and give the output for the following.

Solution:-

Given,

a=10, b=20 and c=30

int r=(a>b)?a:b

>> r=b(a>b is false)

>> r=20

Hence, value of r is 20.

double r=(a+b>=c-a)?b/5:c/5

a+b=30 and c-a=30-10=20

So, a+b>=c-a is true

So,

>> r=b/5

>> r=20/5

>> r=4.0

Hence, the value of r is 4.0

int r=(a+b+c!=50)?a%11:c%3;

>> r=a%11(a+b+c=50 is true)

>> r=10%11=11

> r=11

Hence, the value of r is 11.

int r=(c/a<c-b)?++a:++b

c/a=30/10=3 and c-b=30-20=10

So,

c/a<c-b is true

>> r=++a

>> r=11

Hence, the value of r is 11.

int r=(a<b&&b<c)?a++:b++

>> r=a++(a<b && b<c is true)

>> r=10

Hence, the value of r is 10.

int r=(a>b || b>c && c!=a)?a*b:a*c

>> r=(false || false && true)?a*b:a*c;

>> r=a*c

>> r=30*10

>> r=300

Hence, the value of r is 300.

String r=(a>5 && b<50)?"Win":"Loss";

Here, a>5 is true since 10>5 is true.

Also,

b<50 is true since 20<50 is true.

So,,

>> r="Win"

Hence, the value of r is Win.

String r=(a>50&&b>=50&&c>=50)?"Conquer":"Defeat";

Here,

a>50 and b>=50 and c>=50 is false.

So, the result is false.

>> r="defeat"

Hence, the value of r is defeat.

int r=(a>b)?(a>c)?a:c:(b>c)?b:c;

a>b is false since 10>20 is false.

So,

r=(b>c)?b:c;

Now,

b>c is false since 20>30 is false.

>> r=c

>> r=30

Hence, the value of r is 30.

boolean r=(a>b ||a<c)?true:false

a>b is false but a<c is true.

So,

false || true = true

>> r=true

Hence, result of the expression is true.

Answered by chiragsaini481
0

The notice “The world's most dangerous animals” at a cage in the zoo at Lusaka, Zambia signifies that man is solely responsible for all the deterioration in environment and depletion of natural resources. Thus man is the world's most dangerous animal

Similar questions