![]() Let us see a simple code using this form of a floating-point number.Ĭode: #code to print two floating point numbers and convert it to int value Thus, the number 1.82e18 can be expressed as 1.82 * 10^18. It is another form of a floating-point number. In the next line float value of z is printed, and in the last line, the integer value of z is printed.Ĭonsider the number 1.82e18. ![]() Then the subtracted value is stored in the z variable. In the above code, two float values of 10.1 and 5.5 are assigned to two variables, x and y respectively. ![]() In this example, we will see how to subtract two float values and convert the result to an integer value.Ĭode: #code to subtract float values and convert it to int value Finally, we have converted the float value to the integer value in the next line and printed the same. In the next line, we have printed the float value of c using the float() function. In the next line, we have added both a and b assigned the variable to another variable c. In the above example, we have assigned two values of 5.3 and 3.2 to a and b, respectively. In the next example, we will see how to add two float values and convert them into an integer value. In the next line, we have converted the value to an integer value using the int() function and printed the integer value. In the next line, we have printed the value of x, which is a floating-point number. In the above code, we have declared the value as 10/3 to the variable x. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |