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 with C++ from Control Structures to Objects (9th Edition)
- Which of the following C# types cannot contain floating-point numbers? a. float b. double c. decimal d. intarrow_forwardStream 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_forwardConsider the following code. What should be the smallest value assigned to num such that the number 3 is printed from the last statement print(val)? Question options: 0 1 2 3 4 5 6 None of thesearrow_forward
- The following is the difference between void and NULL pointers: Use relevant examples to back up your statement.arrow_forwardWrite two functions using the following headers:int generate01()void printMatrix(int n)The first function generates and returns a random number either 0 or 1.The second function prints an n-by-n matrix. Each element of the matrix is using the number generated by thefirst function.Write a test program that prompts the user to enter n and uses printMatrix to display an n-by-n matrix. Hereis a sample run:Enter n: 30 1 00 0 10 0 0arrow_forwardCan arrays be used as a return value?arrow_forward
- Can you answer it according to the code below #include #define MAX_EMP 5 struct Employee { int id; int age; float salary; }; int count = 0; struct Employee emp[MAX_EMP]; void display() { printf("\n---=== EMPLOYEE DATA ===---\n"); printf("EMP ID\tEMP AGE\tEMP SALARY\n"); printf("======\t=======\t==========\n"); for(int i = 0; i < count; i++) { printf("%d\t%d\t%.2f\n", emp[i].id, emp[i].age, emp[i].salary); } } void add() { if(count == MAX_EMP) { printf("\nERROR!!! Maximum Number of Employees Reached\n"); return; } printf("\nAdding Employee ===============\n"); printf("Enter Employee ID: "); scanf("%d", &emp[count].id); printf("Enter Employee Age: "); scanf("%d", &emp[count].age); printf("Enter Employee Salary: "); scanf("%f", &emp[count].salary); count++; } void update() { int id, found = 0; float newSalary; printf("\nUpdate Employee Salary…arrow_forwardAs parameters to functions, arrays are passed by value. Select one: O True O False gearrow_forwardIn the expression 48:(14*3), are the brackets necessary? What happens when you type 48:14*3?arrow_forward
- H Step 6: Descriptive Statistics: Points Scored By Your Time in Home Games The management of your team wants you to run descriptive statistics on the points scored by your team in the games played at your team's venue i 2015. Calculate descriptive statistics including the mean, median, variance, and standard deviation for points scored by your team played at Home. following edits to the code block below: 1. Replace ??MEAN_FUNCTION?? with the name of Python function that calculates the mean. 2. Replace ??MEDIAN_FUNCTION?? with the name of Python function that calculates the median. 3. Replace ??VAR_FUNCTION?? with the name of Python function that calculates the variance. 4. Replace ??STD_FUNCTION?? with the name of Python function that calculates the standard deviation. After you are done with your edits, click the block of code below and hit the Run button above. print("Points Scored by Your Team in Home Games (2013 to 2015)") print(" ") your_team_home_df =…arrow_forwardIn C++ Declare a function that is called Compute_Avg. The function returns a float data, receives an integer parameter named “num”, and a float parameter named “Average”.arrow_forwardWhat exactly is an integer division operator?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 PtrProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning