Integer division:
When both operands are integer data types, the resultant statement will be in integer division which means the outcome of the division will also be an integer data type. If there is a remainder, it must be ignored.
Example:
The example for the integer division is as follows:
double value;
value = 5 / 3;
In the above example, the outcome of the “5” by “3” is stored in the variable “value”. The value “1” is stored in the variable “value” because both “5” and “3” are integers, so the decimal part of the result must be truncated.
Floating-point division:
When both operands are floating-point or any one of the operand is a floating-point, the resultant statement will be in floating-point division, which means the outcome of the division will be a floating-point data type.
Example:
The example for the floating-point division is as follows:
double value;
value = 5.0 / 3;
In the above example, the result of the “5.0” by “3” is stored in the variable “value”. The value “1.6667” is stored in the variable “value”, because “5.0” is the floating-point data type and “3” is an integer data type, so the result has a floating-point value.
Want to see the full answer?
Check out a sample textbook solutionChapter 2 Solutions
STARTING OUT C++.+MATLAB+MYPROGRAMLABCDE
- Which of the following C# types cannot contain floating-point numbers? a. float b. double c. decimal d. intarrow_forwardTeacher has prepared the result of a class containing n number of students. He wants to give the award to 3 toppers of the class. Display the Result for 3 toppers as reflected as percentage form in floating type data. Note- include class in code and write the code in C++. Please do this question . Please include class in this codearrow_forwardTeacher has prepared the result of a class containing n number of students. He wants to give the award to 3 toppers of the class. Display the Result for 3 toppers as reflected as percentage form in floating type data Note- Please write a new code in C++arrow_forward
- You are creating a function that manipulates a number. The function has the following requirements:-> A float is passed into the function-> The function must take the absolute value of the float-> Any decimal points after the integer must be removedWhich two math functions should you use? Each correct answer is part of the solution. (Choose two.) Group of answer choices math.floor(x) math.frexp(x) math.ceil(x) math.fmod(x) math.fabs(x)arrow_forwardWhat will be the output of the following code snippet? #include <stdio.h> union example { long price: int quantity; float tax; }: int main() { union example val; val.price = 15; printf("%d", (int)sizeof(val)); val.quantity = 6; val.tax = 0.12; return 0; (a) 8 (b) 16 (c) 14 (d) 4arrow_forwardThe Middletown Wholesale Copper Wire Company sells spools ofcopper wiring for $100 each and ships them for $10 apiece. Write aprogram that displays the status of an order. It should use twofunctions. The first function asks for the following data and storesthe input values in reference parameters.The number of spools ordered.The number of spools in stock.Any special shipping and handling charges (above the regular$10 rate).arrow_forward
- What will be the value of AL after executing the following code? MOV AL, 255 ADD AL, 1 ADC AL, 00arrow_forwardConsider the following code. num = NOT_Assigned alist = [5, 0, 2, 4, 6, 3, 1] val = 0 for i in range(0, num): val = alist[alist[val]] print(val) What should be the smallest value assigned to num such that the number 3 is printed from the last statement print(val)?arrow_forwardFor the following function, specify the type of its return. You can assume each function is called with an appropriate argument, as specified by its docstring. def f(x, y): """ x: int or float. y: int or float """ x + y - 2 a. float b. int c. int or float d. NoneType e. booleanarrow_forward
- Stream manipulator showpoint forces floating-point values to print with the default sixdigits of precision unless the precision value has been changed, in which case floatingpoint values print with the specified precision. T/Farrow_forwardThe Middletown Wholesale Copper Wire Company sells spools ofcopper wiring for $100 each and ships them for $10 a piece. Write aprogram that displays the status of an order. It should use twofunctions. The first function asks for the following data and storesthe input values in reference parameters.The number of spools ordered.The number of spools in stock.Any special shipping and handling charges (above the regular$10 rate). The second function receives as arguments any values needed tocompute and display the following information: The number of ordered spools ready to ship from current stock.The number of ordered spools on backorder (if the numberordered is greater than what is in stock).The total selling price of the portion ready to ship (the number ofspools ready to ship times $100).Total shipping and handling charges on the portion ready to ship.Total of the order ready to ship.The shipping and handling parameter in the second function shouldhave the default argument 10.00.arrow_forwardWhat's the difference between a float and a double integer, exactly?arrow_forward
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr