Skip to content
Sign upLog in
← Back to Community

Type Casting Programming Exercise #3

Profile icon
keithfiore

Instructions
Input a double and print the first two digits after the decimal point with a space between them.

Sample run:
Please input a decimal number:
2.8934
Answer: 8 9

Hint - to complete the second coding activity in lesson 5 you had to learn how to get individual digits from an int value. You can reuse this method once you convert the user input to an appropriate int value
(you will need both multiplication and casting for this)

Voters
Profile icon
NathanPokuta
Profile icon
TyMcgivery
Profile icon
keithfiore