Task No. 1 about integer type conversions

  • 12
  • Locked
This task begins a series of tasks about integer type conversions. This is not a very difficult topic, but it often bewilders noobies because instructors sometimes put in at the very beginning, which is fundamentally wrong. But on Level 10, you're ready. Arrange the cast operators correctly to get the required result: d > 0. The operators are in the conditions.
You can't complete this task, because you're not signed in.
Comments (5)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Elektra
Level 15 , United States of America, United States
21 January 2022, 21:16
Can someone explain to me how the expression ( a + b / f + c ) doesn't trigger a division by zero? Doesn't the division have higher priority than the 2 additions?
Kent Hervey Software Engineer/Consult at Zeal IT ConsultantsExpert
15 March 2020, 23:18
hint: one type only allows positive numbers, so if d is that type...then done
Andrei
Level 41
16 November 2020, 14:36
what i don't understand is why changing every other cast operator results in a negative number?
Ryan
Level 14 , Ashburn, United States
11 March 2019, 04:34
I think line 8 should say: "8. Don't change the initial value of the variables during initialization. You can only add or change cast operators. I got this right but I am also curious why this program does not error out (or show "Infinity") as "f / c" is dividing by 0 as this is the first operation to be performed. It keeps showing -1 which just does not make sense to me.
Aakankasha Sharma
Level 18 , Chandigarh, India
30 June 2020, 11:08
For infinity, perhaps, when the wrap around is taking place, it is assuming a value of -1 in short data type.