+ 1
Is it all rounded?
I did a question where it's pretty much asked 16Ć·5=that's 3.2 but I would only let me do 1 number so just tryed 3 it worked. If stuff like that is all rounded how would it be reliable?
3 Answers
+ 2
As you progress, you will probably do an exercise that asks for you to reverse a multi digit number, eg 4321 becomes 1234.
You can do that with taking the result of modulo 10
šresult=number%10š
(4321%10=1)
and then shifting the original number to the right by a digit
šnumber=number/10š
( 4321/10=432)
Don't forget to shift your result up a significant figure on each loop
šresult=result*10š
(1*10=10)
If you get that done properly, then checking if a number is pallendromic will be as easy as standing on your head! š
It seems complicated, but if you takes it one step at a time you will get it. No worries š
+ 3
What you're doing here is integer/integer division. It just throws away the decimal portion and end up with the integer value.
Try changing one of them into a float and see the output.
16/5.0 or 16.0/5
+ 1
G'day Michael Kreimer
Welcome to being a programmer!!
You will learn two different division operations, one is floor division as in your 16/3=5 the other is modulo as in 16%3=1
Modulo gives the remainder of the division, floor division gives the whole number.
Good luck mate!!!