Question: What happens when you ask a user to type an integer, but they type a floating point number, and you cast their input to an

What happens when you ask a user to type an integer, but they type a floating point number, and you cast their input to an integer?
Question 9 options:
the cast is skipped and the program continues on the next line
the decimal part is truncated (cut off) to get an integer
the number is rounded to the nearest integer
an error - the program crashes
the cast will give a float as the result

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!