Ex: If the input is: the output is: Note: In C++, integer division discards fractions. Ex: 6 / 4 is 1 (the 0.5 is discar
Posted: Tue Jul 05, 2022 10:19 am
Ex: If the input is:
the output is:
Note: In C++, integer division discards fractions. Ex: 6 / 4 is 1 (the 0.5 is discarded). C++ please and thanks
(2) Given three floating-point numbers x, y, and z, output x to the power of z, x to the power of (y to the power of z), the absolute value of y, and the square root of (xy to the power of z). C++ please and thank you
Ex: If the input is:
the output is:
172.466 1.29951e+279 6.5 262.43
(3) Given a long long integer representing a 10-digit phone number, output the area code, prefix, and line number using the format (800) 555-1212.
Ex: If the input is:
the output is:
Hint: Use % to get the desired rightmost digits. Ex: The rightmost 2 digits of 572 is gotten by 572 % 100, which is 72.
Hint: Use / to shift right by the desired amount. Ex: Shifting 572 right by 2 digits is done by 572 / 100, which yields 5. (Recall integer division discards the fraction).
For simplicity, assume any part starts with a non-zero digit. So 0119998888 is not allowed. C++ please and thanks
the output is:
Note: In C++, integer division discards fractions. Ex: 6 / 4 is 1 (the 0.5 is discarded). C++ please and thanks
(2) Given three floating-point numbers x, y, and z, output x to the power of z, x to the power of (y to the power of z), the absolute value of y, and the square root of (xy to the power of z). C++ please and thank you
Ex: If the input is:
the output is:
172.466 1.29951e+279 6.5 262.43
(3) Given a long long integer representing a 10-digit phone number, output the area code, prefix, and line number using the format (800) 555-1212.
Ex: If the input is:
the output is:
Hint: Use % to get the desired rightmost digits. Ex: The rightmost 2 digits of 572 is gotten by 572 % 100, which is 72.
Hint: Use / to shift right by the desired amount. Ex: Shifting 572 right by 2 digits is done by 572 / 100, which yields 5. (Recall integer division discards the fraction).
For simplicity, assume any part starts with a non-zero digit. So 0119998888 is not allowed. C++ please and thanks