Division int and double
We will not stop on most operations since they work as expected. Instead, let's look at the reasons behind the incorrect result obtained from the division operation. Those are explained in a video below:
It's not just a problem limited to division. When you use operators such as +
, -
, *
, or /
on variables of certain types, the resulting value will have the same type as the operands.
It's important to be mindful of these possibilities and take them into account.
Swipe to start coding
- Calculate and output how many meters in a given number of kilometers (
2455
). - Make sure the output number is float and not integer.
Note
In order to get the correct result, we only need to add
.
to any of the numbers in division (9/4.
or9./4
or9./4.
).
Рішення
solution.cpp
Дякуємо за ваш відгук!
single
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Awesome!
Completion rate improved to 4.35Awesome!
Completion rate improved to 4.35
Division int and double
We will not stop on most operations since they work as expected. Instead, let's look at the reasons behind the incorrect result obtained from the division operation. Those are explained in a video below:
It's not just a problem limited to division. When you use operators such as +
, -
, *
, or /
on variables of certain types, the resulting value will have the same type as the operands.
It's important to be mindful of these possibilities and take them into account.
Swipe to start coding
- Calculate and output how many meters in a given number of kilometers (
2455
). - Make sure the output number is float and not integer.
Note
In order to get the correct result, we only need to add
.
to any of the numbers in division (9/4.
or9./4
or9./4.
).
Рішення
solution.cpp
Дякуємо за ваш відгук!
single
Awesome!
Completion rate improved to 4.35
Division int and double
Свайпніть щоб показати меню
We will not stop on most operations since they work as expected. Instead, let's look at the reasons behind the incorrect result obtained from the division operation. Those are explained in a video below:
It's not just a problem limited to division. When you use operators such as +
, -
, *
, or /
on variables of certain types, the resulting value will have the same type as the operands.
It's important to be mindful of these possibilities and take them into account.
Swipe to start coding
- Calculate and output how many meters in a given number of kilometers (
2455
). - Make sure the output number is float and not integer.
Note
In order to get the correct result, we only need to add
.
to any of the numbers in division (9/4.
or9./4
or9./4.
).
Рішення
solution.cpp
Дякуємо за ваш відгук!