Declare a float representing the number of miles traveled fo

Declare a float representing the number of miles traveled for a trip. Define a double representing the numeric constant pi(an approximate number of decimals is fine). Write a forward declaration (i.e. a prototype) for a function that takes a number as a parameter, represented as a double, and evaluates to the square root of that number. What is the value stored in result? int result = 20 + 30/2 * 3 - 5; 20 60 85 13 Given int a = 1 and int b = theta, circle true or false for the following: a && b true false a || b true false !a || b true false a >= b && ! (! b) true false !a || !b == !(a && b) true false

Solution

6) float trip_miles;

7) const double pi = 3.14 ;

8) double sqrt_number(double number);

9) 60; beause first 30/2 = 15 is evaluated. Then 15* 3 =45 is calculated. Then 45+20 =65 is calculate.

At last 65-5 = 60, Ans.

10) Given a=1 , b= 0

1) a && b ; ----------> false //&& means logical and operation. it gives true only if both operands are true.

2) a || b ;--------------------> true // || is logical OR operation which gives true if any one of the operands is true

3)!a || b; ---------------------> false // || is gives false if both operands are false. !a meas NOT a ie it evaluates with a=0

4)a>=b && !(!b)) ---------> false // !(!b) evaluates as b=0 ie first notes evaluate b as 1 but the second not makes it as 0. a>= b is true. But for && gives true only if both operands are true. since !(!b) is false the result is false.

5) !a || !b == !(a && b) -----> true. !(a &&b) evaluates as true. !b is also evaluated as true.

therefore !b == !(a && b) is true. !a evaluated as false. But for OR operator(||) gives one if any one of the operand is true. Therefore the ans is true.

 Declare a float representing the number of miles traveled for a trip. Define a double representing the numeric constant pi(an approximate number of decimals is

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site