Question

In: Computer Science

Evaluate the following expressions: (int)(18.357 * 100)/10 result: _____________ (int)18.357 * 100/10.0 result: _____________ int x...

  • Evaluate the following expressions:
  • (int)(18.357 * 100)/10 result: _____________
  • (int)18.357 * 100/10.0 result: _____________
  • int x = 5; int y = 8; int z = ++x - y--; x=_____ y=_____ z=_____
  • int a = 20; int b = 10; a -= b - 15; a=_____ b=_____  

CSE 118 Fundamentals of programming Java 14.0

Solutions

Expert Solution

  • (int)(18.357 * 100)/10 result: _____183________
  • (int)18.357 * 100/10.0 result: ______180.0_______
  • int x = 5; int y = 8; int z = ++x - y--; x=__6___ y=__7___ z=___-2__
  • int a = 20; int b = 10; a -= b - 15; a=__25___ b=___10__

Proof:


Related Solutions

5. Given the following declarations and assignments, what do these expressions evaluate to? int a1[10] =...
5. Given the following declarations and assignments, what do these expressions evaluate to? int a1[10] = {9, 8, 7, 6, 5, 4, 3, 2, 1, 0}; int *p1, *p2; p1 = a1+3; p2 = &a1[2]; (a) *(a1+4) (b) a1[3] (c) *p1 (d) *(p1+5) (e) p1[-2] (f) *(a1+2) (g) a1[6] (h) *p2 (i) *(p2+3) (j) p2[-1]
x is 5, what is the result of the following Boolean expressions: 1. x != 0  ...
x is 5, what is the result of the following Boolean expressions: 1. x != 0   2. x > 0   3. x != 0 4. x > 0 5. (x >= 0) || (x < 0) 6. (x != 1) == !(x == 1) 7. (true) && (3 > 4) True or False? Please explain how you got your answers. I've been struggling with Boolean expressions so I'd like a little bit more of an explanation as to why each...
For the following exercises, evaluate the expressions, writing the result as a simplified complex number. 1/i11 – 1/i21
For the following exercises, evaluate the expressions, writing the result as a simplified complex number.1/i11 – 1/i21
The 2019 demand and supply for Montreal cannabis are: Demand: P=100-x Supply: P=10+x As a result...
The 2019 demand and supply for Montreal cannabis are: Demand: P=100-x Supply: P=10+x As a result of a successful trade mission to New Zealand, it has agreed to buy Montreal cannabis. Their demand is: P=80-2x What are the economic effects of this trade? Show diagram. Original Price and output? New price and output? Consumption by Montreal? Consumption by New Zealand?
Evaluate the following expressions. The answer must be given as a fraction, NO DECIMALS. If the...
Evaluate the following expressions. The answer must be given as a fraction, NO DECIMALS. If the answer involves a square root it should be entered as sqrt . For instance, the square root of 2 should be written as sqrt(2). If tan ( θ ) = − 5/3 and sin ( θ ) > 0 , then find a) sin(θ)=sin(θ)=     (b) cos(θ)=cos(θ)=     (c) sec(θ)=sec(θ)=     (d) csc(θ)=csc(θ)=     (e) cot(θ)=cot(θ)=
A 10.0 kg metal block measuring 12.0 cm X 10.0 cm X 10.0 cm is suspended...
A 10.0 kg metal block measuring 12.0 cm X 10.0 cm X 10.0 cm is suspended from a spring scale (mass meter) and immersed in water. The 12.0 cm dimension is vertical, and the top of the block is 5.00 cm below the water surface. (A) What are the forces acting at the top and bottom of the block? (Take P0 = 1,013 0 X 105 N / m2.) (B) What is the reading on the spring balance? (C) Show...
Evaluate the following expressions, where two’s complement numbers, A is 11111110 and B is 00000010 and...
Evaluate the following expressions, where two’s complement numbers, A is 11111110 and B is 00000010 and indicate the results. a. A + B b. A – B c. B–A d. –B e. – (-A)
Analyze following program and Find Syntax errors. #include<iostream> int show(int x) int main() {     int A,B;...
Analyze following program and Find Syntax errors. #include<iostream> int show(int x) int main() {     int A,B;       char B=10; cout<<”Enter Value of A”; cin<<A; show(A) show(50)          }       cin.get(); } int show(int x); { cout<<”Value is =” <<X cout<<endl; }
Answer the following What is the difference between these two methods? Void display(int x) Int display(int...
Answer the following What is the difference between these two methods? Void display(int x) Int display(int s) Write a one line of code to generate random numbers from 35 to 55.( not a full program) Draw the UML diagram for a switch statement with 4 cases . Write a while loop to output the value of the variable x starting from 5, decreasing it by 0.5 each time, as long as x remains positive. Write a for loop to display...
#include <stdio.h> int sum(int n); //prototype int main() {     int number, result;     printf("Enter a positive integer:...
#include <stdio.h> int sum(int n); //prototype int main() {     int number, result;     printf("Enter a positive integer: ");     scanf("%d", &number);     result = sum(number);     printf("sum = %d", result);     return 0; } int sum(int n) {     if (n != 0)         return n + sum(n-1);     else         return n; } What does the code above do?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT