What will be the value of x when the following statement is executed:
x=int(98.6)
Answers
Answered by
13
Answer:
98 will be the ans
Explanation:
int() it do not take decimal value
Answered by
2
Concept:
Whole numbers with zero, positive, and negative values but no decimal values are known as integers. For example 15, 7, 0.
int is used for declaring an integer variable.
Given:
x=int(98.6)
Find:
What will be the value of x?
Solution:
We utilize the built-in int() method to convert a float value to an integer. This function trims the values after the decimal point and only returns the integer/whole number part.
Syntax: int(x)
This will remove .6 because they are after the decimal point and only returns 98 as an integer/whole number.
∴ The output will be 98.
Similar questions