Question

Give an example of where it would be preferable to use a float cast over an...

Give an example of where it would be preferable to use a float cast over an int cast.

Homework Answers

Answer #1

Suppose you have "n" integer numbers and you need to calculate average of that "n" numbers then it is not necessary that you always get an integer value as average so at that situation you need to typecast the result in float. for example let n=4

and the number is 2, 3, 8, 5 now if you find the average then you get (2+3+8+5)/4 i.e.   average will be 18/4=4.5 but as you have taken integer numbers so you will get result as 4 but not 4.5 so you need to typecast the result of average in float so that you will get average as 4.5.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Give an example of a problem where it would be appropriate to use a statistical hypothesis...
Give an example of a problem where it would be appropriate to use a statistical hypothesis test for the population mean. Explain what you can determine with such test and how confident you are in your conclusion. Note : Question is related to lean six sigma
Give an example of an "appropriate technology" that might be preferable in a specific developing country...
Give an example of an "appropriate technology" that might be preferable in a specific developing country situation instead of the technology used to solve the same problem in the United States.
Please give one example where (and/or why) would or could a prediction interval be used in...
Please give one example where (and/or why) would or could a prediction interval be used in practice or in your own professional or interest area? What would be the benefit of using a prediction interval over other possible statistical methods?
Give an example where radio based RTK positioning would be preferred.
Give an example where radio based RTK positioning would be preferred.
Fill in the code for the function below called containsAvgValue. It takes as input a float...
Fill in the code for the function below called containsAvgValue. It takes as input a float array of any length and returns 1 if the array happens to contain a value that equals the average of all the values in the array or 0 otherwise. For example, when give the array [2.0, 2.0] it should return 1 since the average value is 2.0 and the array contains that value. To help you, I’ve included a function that computes the average...
1. Discuss the conditions when it would be preferable to use job-order costing over process costing....
1. Discuss the conditions when it would be preferable to use job-order costing over process costing. 2. Explain under-applied overhead and what dispositions is made for it at the end of a period. 3. Discuss what happens to overhead rates that are based on direct labor when automated equipment replaces direct labor. Would manufacturing overhead increase or decrease? Would the predetermined overhead rate increase of decrease? Defend your answer. 4. Discuss the advantages and disadvantages of utilizing multiple overhead rates...
What is one example where you would use grouping to summarize data In this example, if...
What is one example where you would use grouping to summarize data In this example, if you have any filtering criteria would you use the "Where" clause or the "Having" clause and why?
2. Give one example where the official unemployment rate: Over estimates the true level of unemployment....
2. Give one example where the official unemployment rate: Over estimates the true level of unemployment. Under estimates the true level of unemployment.  
Give an example of a situation where a building contractor may want to use the discounted...
Give an example of a situation where a building contractor may want to use the discounted cash flow (DCF) analysis method.
Why is determining standard deviation valuable? Give a relevant example where this would be valuable in...
Why is determining standard deviation valuable? Give a relevant example where this would be valuable in Police work.